From 1d1cb76413099c98be7fd866288a759100566453 Mon Sep 17 00:00:00 2001 From: devhl Date: Fri, 11 Sep 2026 23:19:43 -0400 Subject: [PATCH 1/2] correct error message --- .../generichost/JsonConverter.mustache | 6 ++++-- .../Model/ParentWithPluralOneOfProperty.cs | 2 +- .../Model/HelloWorldPostRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/IconsDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/Shape.cs | 3 --- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 3 --- .../src/Org.OpenAPITools/Model/Widget.cs | 3 --- .../src/Org.OpenAPITools/Model/TestObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../AllOf/src/Org.OpenAPITools/Model/Adult.cs | 6 +++--- .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Person.cs | 4 ++-- .../AnyOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../AnyOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../OneOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../OneOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../AllOf/src/Org.OpenAPITools/Model/Adult.cs | 6 +++--- .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Person.cs | 4 ++-- .../AnyOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../AnyOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../OneOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../OneOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../AllOf/src/Org.OpenAPITools/Model/Adult.cs | 6 +++--- .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Person.cs | 4 ++-- .../AnyOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../AnyOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../OneOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../OneOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../AllOf/src/Org.OpenAPITools/Model/Adult.cs | 6 +++--- .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Person.cs | 4 ++-- .../AnyOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../AnyOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../OneOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../OneOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../AllOf/src/Org.OpenAPITools/Model/Adult.cs | 6 +++--- .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Person.cs | 4 ++-- .../AnyOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../AnyOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../OneOf/src/Org.OpenAPITools/Model/Apple.cs | 2 +- .../OneOf/src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- .../src/Org.OpenAPITools/Model/Activity.cs | 2 +- .../ActivityOutputElementRepresentation.cs | 4 ++-- .../Model/AdditionalPropertiesClass.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +++--- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 --- .../Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../Model/ArrayOfNumberOnly.cs | 2 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 6 +++--- .../src/Org.OpenAPITools/Model/BasquePig.cs | 3 --- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++++------ .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 --- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 6 ------ .../Org.OpenAPITools/Model/CopyActivity.cs | 3 --- .../src/Org.OpenAPITools/Model/DanishPig.cs | 3 --- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Descendant1.cs | 6 ------ .../src/Org.OpenAPITools/Model/Descendant2.cs | 6 ------ .../src/Org.OpenAPITools/Model/Dog.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Drawing.cs | 4 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../Model/EquilateralTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../Model/FileSchemaTestClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../Model/FooGetDefaultResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 20 +++++++------------ .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 ++-- .../Model/InjectedVendorExtensionsTest.cs | 12 +++++------ .../Model/IsoscelesTriangle.cs | 6 ------ .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 ++-- .../src/Org.OpenAPITools/Model/MapTest.cs | 8 ++++---- .../src/Org.OpenAPITools/Model/MixedAnyOf.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedOneOf.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/Org.OpenAPITools/Model/MixedSubId.cs | 2 +- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- ...cationtestGetElementsV1ResponseMPayload.cs | 3 --- .../Org.OpenAPITools/Model/NullableClass.cs | 4 ++-- .../Model/ObjectWithDeprecatedFields.cs | 6 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 10 ++-------- .../Model/QuadrilateralInterface.cs | 3 --- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 ++-- .../Org.OpenAPITools/Model/RequiredClass.cs | 10 ++-------- .../src/Org.OpenAPITools/Model/Result.cs | 6 +++--- .../src/Org.OpenAPITools/Model/Return.cs | 5 +---- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 6 ------ .../Org.OpenAPITools/Model/ShapeInterface.cs | 3 --- .../Model/SimpleQuadrilateral.cs | 6 ------ .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- .../TestCollectionEndingWithWordListObject.cs | 2 +- .../Org.OpenAPITools/Model/TestDescendants.cs | 3 --- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/TestResult.cs | 4 ++-- .../Model/TriangleInterface.cs | 3 --- .../src/Org.OpenAPITools/Model/User.cs | 14 ++++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 3 --- .../src/Org.OpenAPITools/Model/Zebra.cs | 3 --- 1350 files changed, 1946 insertions(+), 3735 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 7948f79dbf7c..e97c5c610076 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 @@ -456,9 +456,11 @@ {{^isDiscriminator}} {{^isNullable}} {{#vendorExtensions.x-is-reference-type}} - if ({{^required}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.IsSet && {{/required}}{{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} == null) - throw new ArgumentNullException(nameof({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}), "Property is required for class {{classname}}."); + {{^required}} + if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.IsSet && {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} == null) + throw new JsonException("Cannot write null property {{classname}}.{{name}} to non-nullable JSON property '{{baseName}}'."); + {{/required}} {{/vendorExtensions.x-is-reference-type}} {{/isNullable}} {{/isDiscriminator}} diff --git a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/ParentWithPluralOneOfProperty.cs b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/ParentWithPluralOneOfProperty.cs index 2f55ea9f5d23..5dfece8a6d02 100644 --- a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/ParentWithPluralOneOfProperty.cs +++ b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/ParentWithPluralOneOfProperty.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, ParentWithPluralOneOfProperty public void WriteProperties(Utf8JsonWriter writer, ParentWithPluralOneOfProperty parentWithPluralOneOfProperty, JsonSerializerOptions jsonSerializerOptions) { if (parentWithPluralOneOfProperty.NumberOption.IsSet && parentWithPluralOneOfProperty.Number == null) - throw new ArgumentNullException(nameof(parentWithPluralOneOfProperty.Number), "Property is required for class ParentWithPluralOneOfProperty."); + throw new JsonException("Cannot write null property ParentWithPluralOneOfProperty.Number to non-nullable JSON property 'number'."); if (parentWithPluralOneOfProperty.NumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Model/HelloWorldPostRequest.cs b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Model/HelloWorldPostRequest.cs index ec7288f8f566..83136644b5e5 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Model/HelloWorldPostRequest.cs +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Model/HelloWorldPostRequest.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, HelloWorldPostRequest helloWor public void WriteProperties(Utf8JsonWriter writer, HelloWorldPostRequest helloWorldPostRequest, JsonSerializerOptions jsonSerializerOptions) { if (helloWorldPostRequest.MessageOption.IsSet && helloWorldPostRequest.Message == null) - throw new ArgumentNullException(nameof(helloWorldPostRequest.Message), "Property is required for class HelloWorldPostRequest."); + throw new JsonException("Cannot write null property HelloWorldPostRequest.Message to non-nullable JSON property 'message'."); if (helloWorldPostRequest.MessageOption.IsSet) writer.WriteString("message", helloWorldPostRequest.Message); diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/Foo.cs index e921fe3416c3..f584d270555a 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/Foo.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/IconsDefaultResponse.cs b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/IconsDefaultResponse.cs index af4a73936b1e..46fd8d0a3dd3 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/IconsDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Model/IconsDefaultResponse.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, IconsDefaultResponse iconsDefa public void WriteProperties(Utf8JsonWriter writer, IconsDefaultResponse iconsDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (iconsDefaultResponse.StringOption.IsSet && iconsDefaultResponse.String == null) - throw new ArgumentNullException(nameof(iconsDefaultResponse.String), "Property is required for class IconsDefaultResponse."); + throw new JsonException("Cannot write null property IconsDefaultResponse.String to non-nullable JSON property 'string'."); if (iconsDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs index ca85052009df..10881800c2e4 100644 --- a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(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); if (shape.AreaOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 73973f2d1427..a0f026d80cd3 100644 --- a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(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); if (shapeOrNull.AreaOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Widget.cs b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Widget.cs index df6723c9cd6b..d212692286b3 100644 --- a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Widget.cs +++ b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Widget.cs @@ -248,9 +248,6 @@ public override void Write(Utf8JsonWriter writer, Widget widget, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Widget widget, JsonSerializerOptions jsonSerializerOptions) { - if (widget.Name == null) - throw new ArgumentNullException(nameof(widget.Name), "Property is required for class Widget."); - writer.WriteNumber("id", widget.Id); writer.WriteString("name", widget.Name); diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Model/TestObject.cs b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Model/TestObject.cs index 481d615acef8..49c748d7fb39 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Model/TestObject.cs +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Model/TestObject.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, TestObject testObject, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestObject testObject, JsonSerializerOptions jsonSerializerOptions) { if (testObject.NameOption.IsSet && testObject.Name == null) - throw new ArgumentNullException(nameof(testObject.Name), "Property is required for class TestObject."); + throw new JsonException("Cannot write null property TestObject.Name to non-nullable JSON property 'name'."); if (testObject.NameOption.IsSet) writer.WriteString("name", testObject.Name); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Activity.cs index 29826c4d7073..27267a89b539 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Activity.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 05098c80f7fb..003514970fcc 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -192,10 +192,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index c70f1ba05afb..03a63cf9238e 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -328,25 +328,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Animal.cs index 432daa82dad9..e9fd3ed17925 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Animal.cs @@ -215,7 +215,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ApiResponse.cs index 1d6c89d36d8e..28e98de7e92e 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -215,10 +215,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Apple.cs index 9d1295109b0e..8aba169c7737 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Apple.cs @@ -245,13 +245,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AppleReq.cs index e0e6f35b1611..2aacb278a4d4 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AppleReq.cs @@ -187,9 +187,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 52f3744aa5ea..c5d0c0120cb6 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 62378f267b61..37e33d235abf 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayTest.cs index 7974f4efff16..d28d7086029c 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -215,13 +215,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/BasquePig.cs index 033cba8ed79c..abd455115d64 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/BasquePig.cs @@ -164,9 +164,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Capitalization.cs index 862fe329b41b..41f67b976b5f 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Capitalization.cs @@ -285,22 +285,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Cat.cs index 5fbb545e21b8..f46fd29e6908 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Cat.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Category.cs index 451478c2ed84..ea3a6ea302a6 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Category.cs @@ -187,9 +187,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ChildCat.cs index a5b6a1a361ae..aef73addc4cb 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ChildCat.cs @@ -237,7 +237,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ClassModel.cs index 0c3424c441c1..f87938353430 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ClassModel.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index c97bad4c55da..9afab7e4e027 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -183,12 +183,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/CopyActivity.cs index 9b1c9ee1e369..69523975f71e 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -232,9 +232,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DanishPig.cs index 3363805c59d8..ffcd3973301e 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DanishPig.cs @@ -164,9 +164,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 04c3dda88f82..f2fa0117113b 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Descendant1.cs index 76c710dacb68..3113069aea3a 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Descendant1.cs @@ -183,12 +183,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Descendant2.cs index e8a0952a86b0..62f9a8ffa5e0 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Descendant2.cs @@ -183,12 +183,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Dog.cs index c63877fbf113..4fa08c7e3d5e 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Dog.cs @@ -178,10 +178,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Drawing.cs index 63a87e544f2f..450a44bf35b2 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Drawing.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs index f1d4a0e2bfb4..659d58160163 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -331,7 +331,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 85a3403c71ac..7291b85426f3 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -183,12 +183,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/File.cs index 1ee7b71a9890..09cd9b5bf640 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/File.cs @@ -170,7 +170,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 77293c60ec4b..87b218a512cc 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -192,10 +192,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Foo.cs index e921fe3416c3..f584d270555a 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Foo.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index a12c72466ae3..a232f90cafd4 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FormatTest.cs index e3596c5a4092..33eac5e64a20 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FormatTest.cs @@ -945,32 +945,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Fruit.cs index f6b30057b6ca..89a1ee84e622 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Fruit.cs @@ -220,7 +220,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/GmFruit.cs index b33fb75226b5..ab33328b55dd 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/GmFruit.cs @@ -237,7 +237,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 00aca88d3a1c..b10b320ea8e0 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -192,10 +192,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 857b6fb30f3e..9cde7d5b8f89 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -284,22 +284,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 588757bf5fd4..80aef9813347 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -183,12 +183,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/List.cs index 200394e4d2eb..9e7b530c64a1 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/List.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 319ae3d0abc6..760943a4edef 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -192,10 +192,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MapTest.cs index 41fb19a2a48d..ccbba4ceeae3 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MapTest.cs @@ -304,16 +304,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 4009477278c7..5eb5ee1c3d2d 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedOneOf.cs index eb8e45550813..7d90d152a794 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3497b5c2bb84..3cbcbb3908ed 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -250,7 +250,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedSubId.cs index 6e37f0cfeede..7b00310a46f1 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Model200Response.cs index bbe7792780ea..a83c22abd0e2 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Model200Response.cs @@ -192,7 +192,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ModelClient.cs index 4d85d9782f32..aa47d610cb2c 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ModelClient.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Name.cs index 288b16affea6..13e1f5d09f0f 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Name.cs @@ -234,7 +234,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 7bd2e1331c47..968636eb694f 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -183,9 +183,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NullableClass.cs index 272df03fc809..c9631230e6ac 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NullableClass.cs @@ -409,10 +409,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index eaee8ff08ff9..2cc87c1fbb20 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -241,13 +241,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/OuterComposite.cs index fb3180ab6323..3e6c81901f4b 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -215,7 +215,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Pet.cs index 5a9db85b6482..1daeda083e0c 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Pet.cs @@ -365,17 +365,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index bdf77ab1396f..4aaf0d1665fb 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -164,9 +164,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index cf5fd20b3b56..d6a361257e44 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -192,10 +192,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RequiredClass.cs index 2b605afe9f2f..255f94aa5249 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2229,17 +2229,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Result.cs index 7f3bb40950bd..c766fe3ca280 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Result.cs @@ -218,13 +218,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Return.cs index 260a7a262926..7c9fcad64d64 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Return.cs @@ -226,11 +226,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 117691977974..69c97d82b5b8 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -192,7 +192,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 4706ca62bf0e..a906d0f6d0dd 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 19645ef302f1..c732bc01a5ad 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -183,12 +183,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ShapeInterface.cs index 39bfe84b80f8..f9441871bb4f 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -164,9 +164,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index db0c148fc847..d3bc2dfb85b3 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -183,12 +183,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SpecialModelName.cs index fe691a044fe6..898f8ebce963 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -192,7 +192,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Tag.cs index b4884d224bcc..16d4fafd3403 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Tag.cs @@ -192,7 +192,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 7a1eaf17a23b..c6dd3fd660ca 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 778000c56eb0..a6979a10b1c9 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestDescendants.cs index d91d79f57fa7..4da09fa5643c 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -283,9 +283,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 1d82f412eb89..7d85da50aa83 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestResult.cs index dd2152fe0362..874fcdfaf351 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestResult.cs @@ -217,10 +217,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TriangleInterface.cs index 65f9c875351a..5ba7f95069db 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -164,9 +164,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/User.cs index 08d85778dc61..c6567fbbde5e 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/User.cs @@ -418,25 +418,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Whale.cs index c0813e422cf9..2c1da03ee7ae 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Whale.cs @@ -210,9 +210,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Zebra.cs index 9562526e8238..94895fe9757f 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Zebra.cs @@ -281,9 +281,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Adult.cs index eb8cbd0b3bc5..4213420714a8 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -184,13 +184,13 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { if (adult.ChildrenOption.IsSet && adult.Children == null) - throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.Children to non-nullable JSON property 'children'."); if (adult.FirstNameOption.IsSet && adult.FirstName == null) - throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.FirstName to non-nullable JSON property 'firstName'."); if (adult.LastNameOption.IsSet && adult.LastName == null) - throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.LastName to non-nullable JSON property 'lastName'."); if (adult.ChildrenOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Child.cs index cc9001600c71..4aa344a128f6 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -207,10 +207,10 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { if (child.FirstNameOption.IsSet && child.FirstName == null) - throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); if (child.LastNameOption.IsSet && child.LastName == null) - throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.LastName to non-nullable JSON property 'lastName'."); if (child.AgeOption.IsSet) writer.WriteNumber("age", child.AgeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Person.cs index e5e63ec9c2a5..e65419a3b600 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Person.cs @@ -243,10 +243,10 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { if (person.FirstNameOption.IsSet && person.FirstName == null) - throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.FirstName to non-nullable JSON property 'firstName'."); if (person.LastNameOption.IsSet && person.LastName == null) - throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.LastName to non-nullable JSON property 'lastName'."); if (person.FirstNameOption.IsSet) writer.WriteString("firstName", person.FirstName); diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Apple.cs index ba3ebde0806b..e6e5bf9b1853 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs index a552837a0067..9ccac387b196 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -245,7 +245,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs index 6d957f4666fe..ba2d70c2fab5 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs index b23a45484ba3..c7ad4a614836 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs @@ -244,7 +244,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Activity.cs index 8883f1323639..2fb20fd76ba8 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index a7ae93ee504a..a7c053f968ff 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 4c9fc1cad5f2..2d355959392c 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Animal.cs index 117be25b4c3f..90faf3ed2ad0 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a61538e1f17..894db21c2542 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Apple.cs index ead5728d626b..8559896f3b99 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index bd8cd61c4221..1096570780ec 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 850a9c376b5a..9a6a9cb6326c 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 2e5eb229f1c3..1b911bc1d6c0 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index 2b63506f4b44..e42133d4a724 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs index ea23cb6d7166..57decedb097c 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 9ff7be2175c6..0cd7b560fb24 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Category.cs index b977a0ca50b9..df8dc6dc03e2 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs index db3c3064f4e2..46fc753b3481 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); writer.WriteString("pet_type", ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCat.PetType)); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs index 4d1213df9a8d..012fb4ea1848 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs index 2a75237fd09f..8d25c498e494 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs index a0a059430fbf..4e0d1370cc9a 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs index 4386ed6689ff..5b8587c218e1 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs index d0974d2d3ae9..82cc312ea062 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Dog.cs index e4066eb72582..5d01cd38ebbe 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index fce60664f896..b1c4e76fe748 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index a954055cecef..943f8ad3d406 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/File.cs index e6c3a7cd844f..598363737a5e 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 433035256031..74bfbfa1b1ec 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Foo.cs index 9da199ab2477..ab3a41f87790 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 8e9bba64db14..5d64e47dc7f5 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 7c655b0827f2..a00d62ec2e06 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Fruit.cs index ca703d27f96c..a73048ec0ad1 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs index c3c2a4e247ab..7071fe00f86d 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index fbd98eae40a9..2f37dd2a61d9 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/List.cs index d6ac694585ca..b65cac7456c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs index e0e39a3acce3..4b1007e9aaf5 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index a416718859af..463b714170dd 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -244,16 +244,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 42247df00c07..57207f29ddb1 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index a8f039e97905..c3a43f3fc745 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index c54becfdc303..228d6c3cab98 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs index ec25fab92034..c1fbf300b336 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index a78b4b9ae3a8..d75e2197a1a7 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs index 9135c0e022ad..f4acaf49d8f1 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Name.cs index e3a0ef4d62fc..fc65064ac4e8 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index b83140b058a7..0c4818c0bff4 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index a6be5066e8cd..56dfe1215b0d 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 994ccd227bef..9fd968c817d6 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs index b94bf16627ff..65396833098d 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -282,17 +282,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 495b0d273f6a..ddd15217fc1f 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index b84dae9064af..16e4165975b4 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,17 +1053,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Result.cs index 3d22bb06491f..b57d0b4c7e8e 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Return.cs index 184ad3ab12c4..d655ddfb2ce0 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index d67bf5ddc948..e3676b9555c5 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 27c3871866be..22702cfaa178 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index a24895d6f930..edcba4dae388 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Tag.cs index ce29344d2cdf..879c52edb8a1 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 764f36716e27..b48698e26e70 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index d6de3eb2c298..4d1c9e06a24f 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs index e77c43ecd5d4..c5b9db5913dd 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a09ec60e3535..5bd2ec9a6bba 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index e023fb8f77fc..0ca59c6ad79b 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net10/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/User.cs index dc078c480cbc..cf3e65aa1327 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 02655307d760..9f99606b7fa8 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 449736faed56..61583d889dad 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs index 4103a73cd4f0..d43c6780ca28 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index adf86a28dcd0..23f5c4b3a85d 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 2c52c15ccdcc..ad641f68f2e9 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -336,25 +336,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs index b5e2ed9ae27f..6344d530cd6e 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs @@ -223,7 +223,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs index ffbd21ce4a6a..866888eb836c 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs index 0f80dc0d9c03..edd6e65f1f41 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs @@ -253,13 +253,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs index a43c764f8240..5091186fdbdc 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -188,9 +188,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index aef7d7e481d8..509645c3f350 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 93684cf9efc6..9d5c27336962 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs index 0b5b6d24743d..14d7950c4b6f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -223,13 +223,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs index a19a8488e044..8dbfb7552b5f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs index eb14befa97d3..68e8220438eb 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs @@ -293,22 +293,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs index b1fedb233db5..0759faaf06af 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -179,7 +179,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs index 97e28530372b..4101d46d205f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -195,9 +195,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs index d99184db6550..d7c5a4cd96ec 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs @@ -238,7 +238,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs index a7666cfb698a..16551511b256 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index cbc3e80b4a27..e1e504b538e1 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs index 77fc65981096..260d78873e2e 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -233,9 +233,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs index 6ee21a0298c9..ed6bc6534338 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 0490d964f022..5e4782e9741b 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs index b78ed38fc503..68a2f65c9aff 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs index d4c4e6c2273c..5a130166a0b1 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs index 6908fb106b63..b8435f95759c 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs @@ -179,10 +179,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs index 74c2e0ae5d4b..cce96329e588 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs @@ -240,10 +240,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs index 3bcb6d9b4888..8fa2f6d57739 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,7 +339,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index bf25136ce8d5..407e33a7b6f5 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs index 668ebfa6c77c..6608c8f2c0e0 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index b29be867e838..d8837421dcac 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs index 98e50928aae1..4b75918a83d5 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 763577d494c8..baa4b149818a 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs index d7ca66d7495a..0291786cf4e5 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -953,32 +953,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs index ec0062ba20d3..f902f78034c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs index 039f5faedfc4..1eccb13e9003 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs @@ -238,7 +238,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 6fa1889a08bd..1a446ca46e5a 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -241,10 +241,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 962e2a3c1294..82b78a3e00f9 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -339,22 +339,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index fac6f52f2522..b211cf0586b1 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs index aac40319978e..b8a8a257d0d2 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 027d4fde6be0..70963bef2fc5 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs index 3c7e075d574e..64474ff0d16d 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs @@ -312,16 +312,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 71af55e64992..48eca2b1e0b8 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs index 1536ccf00030..e5c9f6f2f2f7 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index d7d6068bcd10..175027917ad1 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -258,7 +258,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs index 7f178b026301..77c1611f8f80 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs index 2d6852d12c7e..f79e2eac8d8f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs index 0e9021c907a6..b32d7f964146 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs index d54d7b7d29b5..5d7ca65e2a70 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -283,7 +283,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 2e206a226911..10c8125b1068 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -191,9 +191,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs index ea88ed18b540..d1327d7b480f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs @@ -410,10 +410,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index c858d1b3727b..1007be70c886 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -249,13 +249,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs index 6ed3bf816867..bdd0db7f40e9 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -223,7 +223,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs index 6cd3a02b4296..b9556e0402d0 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -373,17 +373,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 33061272899b..bbd3a56b31ed 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index bb29062628a7..3b1999efb42d 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs index d1f6c6f40209..f8f5a836850e 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2237,17 +2237,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs index 17f97f2387a3..a6bef2efe103 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs @@ -226,13 +226,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs index 02b3fdc639e2..aeaa9fe0d2c2 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -234,11 +234,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs index affe88bd8aea..56e323eb1cc8 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index ed0af26e87fb..55d774689f49 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index ada72abaf3ad..f1779050584b 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs index 7d55af95627a..cb375197e488 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 48481ee56dfe..0034604725d0 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs index 7af87418b89f..4d3a32498644 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs index fbc5d4a9829e..ed520154f099 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index dc66551a230d..182412d38e32 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index f297317601df..97b4b270f1c9 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs index c9e049a3db72..5b568b36e9ec 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -291,9 +291,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 32e069929830..07d98ed51393 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs index 1edb92ec63a9..19455a837c65 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs @@ -225,10 +225,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs index 9fbc6b8085b5..c97244ab95ff 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs index 50de52ddebec..7c8a73e2ca82 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -426,25 +426,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs index 00e53f6dc690..a855f0431854 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -218,9 +218,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs index a871ad34d76d..a9f35d0bd260 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs @@ -282,9 +282,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Apple.cs index ba3ebde0806b..e6e5bf9b1853 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Fruit.cs index 1a4743015087..af45459bafc7 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -252,7 +252,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Activity.cs index 8883f1323639..2fb20fd76ba8 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index a7ae93ee504a..a7c053f968ff 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 4c9fc1cad5f2..2d355959392c 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Animal.cs index 117be25b4c3f..90faf3ed2ad0 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a61538e1f17..894db21c2542 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Apple.cs index ead5728d626b..8559896f3b99 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index bd8cd61c4221..1096570780ec 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 850a9c376b5a..9a6a9cb6326c 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 2e5eb229f1c3..1b911bc1d6c0 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 2b63506f4b44..e42133d4a724 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs index ea23cb6d7166..57decedb097c 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 9ff7be2175c6..0cd7b560fb24 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Category.cs index b977a0ca50b9..df8dc6dc03e2 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs index aad251c4d9e7..d5e2a907d867 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs index 4d1213df9a8d..012fb4ea1848 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs index 73f65a894734..790b30d0598c 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -231,9 +231,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs index a0a059430fbf..4e0d1370cc9a 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs index 8abf3f5844d0..00e11bca0df2 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs index 5484c2ec84ad..3ad11787dcb3 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Dog.cs index e4066eb72582..5d01cd38ebbe 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index fce60664f896..b1c4e76fe748 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index 45da2f7dc94c..bc284aa6ef5d 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -337,7 +337,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/File.cs index e6c3a7cd844f..598363737a5e 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 433035256031..74bfbfa1b1ec 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Foo.cs index 9da199ab2477..ab3a41f87790 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 8e9bba64db14..5d64e47dc7f5 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 7c655b0827f2..a00d62ec2e06 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Fruit.cs index ca703d27f96c..a73048ec0ad1 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs index c3c2a4e247ab..7071fe00f86d 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index f8b20bd77658..4703397c61b3 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/List.cs index d6ac694585ca..b65cac7456c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs index e0e39a3acce3..4b1007e9aaf5 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MapTest.cs index 41b65bf5bc38..b5cdc783088c 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MapTest.cs @@ -310,16 +310,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 42247df00c07..57207f29ddb1 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index a8f039e97905..c3a43f3fc745 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index c54becfdc303..228d6c3cab98 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs index ec25fab92034..c1fbf300b336 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index a78b4b9ae3a8..d75e2197a1a7 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs index 9135c0e022ad..f4acaf49d8f1 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Name.cs index e3a0ef4d62fc..fc65064ac4e8 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index b83140b058a7..0c4818c0bff4 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index a6be5066e8cd..56dfe1215b0d 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 994ccd227bef..9fd968c817d6 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 41de214278b4..a95f55c8bee3 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -371,17 +371,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 495b0d273f6a..ddd15217fc1f 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index bda0936c7e46..697eb747f6ec 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,17 +2235,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Result.cs index 3d22bb06491f..b57d0b4c7e8e 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Return.cs index 184ad3ab12c4..d655ddfb2ce0 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index d67bf5ddc948..e3676b9555c5 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 27c3871866be..22702cfaa178 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index a24895d6f930..edcba4dae388 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Tag.cs index ce29344d2cdf..879c52edb8a1 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 764f36716e27..b48698e26e70 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index d6de3eb2c298..4d1c9e06a24f 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs index 3b7c69765ecd..a28ece650979 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -289,9 +289,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a09ec60e3535..5bd2ec9a6bba 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index e023fb8f77fc..0ca59c6ad79b 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net10/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/User.cs index dc078c480cbc..cf3e65aa1327 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 02655307d760..9f99606b7fa8 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 26ed2ec21c31..476487740ff7 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,9 +280,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs index 80dce6546255..14a5655c8023 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index b609046e8738..06c18ced2a1c 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index cd282ab084bb..d4e0bd11b830 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -337,25 +337,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs index 2fa4fe8d9972..6861539d48cb 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs @@ -224,7 +224,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs index f0ae4ef850cb..ff9b64de4fe5 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -224,10 +224,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs index edbe669c8994..ed26f278fc46 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs @@ -254,13 +254,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs index 0b270e3d4ebb..505491f73869 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 6351ae775d17..270d77309df1 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index f1d13b9ea264..c2fbcd6a7e57 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs index 6fe159c3a522..877795d5cfd4 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs index 04f114d2c52d..d2b0f9fc8e45 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs index b1ad2e90a31e..26ea3730fba7 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs @@ -294,22 +294,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs index 306e5e5f4010..4231f2c01135 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -180,7 +180,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs index 60daf384a42b..33ec2ed9905d 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -196,9 +196,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs index 61e9f0c189bc..77c923435187 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs @@ -239,7 +239,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs index 187afe4824bb..90236769cb4a 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index a7184463a89b..d1828daed8ba 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs index b5df3dc0625e..7c1c3f7fe287 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -234,9 +234,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs index 130e644a578d..94e9213fe899 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 06763ca2d13c..4b96563e3461 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs index 4547aa00e1c6..48aba268c5b9 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs index 5c2a73bce3fd..aae60577a78f 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs index ad6546f5ed2e..f43fe465b65a 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs @@ -180,10 +180,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs index c842739103d3..d26192a1adba 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs @@ -241,10 +241,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs index ec67776ec0a4..d07f1518f6ce 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -340,7 +340,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index c10e5ccee004..a4d6ad4c2f68 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/File.cs index ddeebaa52e17..c26fe4f172ce 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/File.cs @@ -179,7 +179,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index d90772377b69..77eeacd1bfce 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs index c0fff6bbf2db..a26bca0b15d4 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index b0493a92bcf0..23d6edaccb8c 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs index a2a69a9962fb..50a33f2580bf 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,32 +954,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs index 9bad6c70417c..b9adf9d71cc8 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs @@ -222,7 +222,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs index 2dff0e74d24c..a2198a7ec32a 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs @@ -239,7 +239,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 716fb2ec240c..098874540247 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -242,10 +242,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 4682d88e6894..f14013f65705 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -340,22 +340,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index d936a509fa55..261267b6c02f 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/List.cs index 0af9622c0f0c..d6cd61b8668e 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/List.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 0b811f15795c..3de1c9b7ebc5 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs index 57ff0614c54e..a8ff51c976de 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs @@ -313,16 +313,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 93d9cddbe354..93b19a688f74 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2f853d145282..f79216144534 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index da7a9e873433..e75d3ba0ffc5 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -259,7 +259,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs index 3ee3e91634c4..e9036f7546d3 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs index 8ed7851b3215..44a323173884 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs index bac5b01c0825..357ce5b2d143 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs index 56ab59544304..fc70dd80cb4d 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -284,7 +284,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 8f71e4492518..358f13e8de5f 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -192,9 +192,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs index b24440849590..5bf7c08c2823 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs @@ -411,10 +411,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 3602dfda1310..62fccbbcc8a0 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -250,13 +250,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs index 0c0d0abd343f..9791bf2027d3 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -224,7 +224,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs index ad57645de2f5..b91b50503d72 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -374,17 +374,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 63195ad709ae..ac2b8e61cd67 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index b411dc6e9d33..8a93f3022a91 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs index 41a2c79c34d6..3ba198d8e0bd 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2238,17 +2238,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs index 02d0d8c34c20..5e2d71377d97 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs @@ -227,13 +227,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs index 6ac928d7c6b8..ef308616828c 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -235,11 +235,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 9c544ea876ee..1d07de3a4b45 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index b1122b96b779..e292a138c48e 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 6e5cff7d75a8..9e866915b32f 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs index 94079e588b26..5aedd501c226 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 794c35454611..e7ed21a8c3ca 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs index 1e1b860dedd7..345cd905709a 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs index df7dabd4bbb6..7f53fa7ebbbd 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index b42fcd243ecc..508388831ad1 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 5e985a42157a..cdd78842b091 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs index 6b0ee1bbe913..7410185d15aa 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -292,9 +292,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 9c65047ab818..41fcb61c7c76 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs index d935ee12b186..2ef0d0971d77 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs @@ -226,10 +226,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs index 78caa9c95ad1..20b576d5efbd 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/User.cs index 01aeeb13e1de..ea4bce9e000e 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -427,25 +427,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs index 89658a5314c9..f66ffed7581c 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -219,9 +219,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs index 3d814ffc0b00..d5e1f9506697 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs @@ -283,9 +283,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Adult.cs index 199c6bc71de3..7c252ba330b0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -182,13 +182,13 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { if (adult.ChildrenOption.IsSet && adult.Children == null) - throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.Children to non-nullable JSON property 'children'."); if (adult.FirstNameOption.IsSet && adult.FirstName == null) - throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.FirstName to non-nullable JSON property 'firstName'."); if (adult.LastNameOption.IsSet && adult.LastName == null) - throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.LastName to non-nullable JSON property 'lastName'."); if (adult.ChildrenOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs index ce3a88b9d5b7..92932af4440b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -205,10 +205,10 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { if (child.FirstNameOption.IsSet && child.FirstName == null) - throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); if (child.LastNameOption.IsSet && child.LastName == null) - throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.LastName to non-nullable JSON property 'lastName'."); if (child.AgeOption.IsSet) writer.WriteNumber("age", child.AgeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Person.cs index 55e576ab5dab..fea620444347 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Person.cs @@ -241,10 +241,10 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { if (person.FirstNameOption.IsSet && person.FirstName == null) - throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.FirstName to non-nullable JSON property 'firstName'."); if (person.LastNameOption.IsSet && person.LastName == null) - throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.LastName to non-nullable JSON property 'lastName'."); if (person.FirstNameOption.IsSet) writer.WriteString("firstName", person.FirstName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Apple.cs index a515b6a46baf..20d70a152cc9 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs index 0b53a273b3d9..5ccdcf14a13d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -243,7 +243,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs index cc733fa3ac1b..136b36a89958 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs @@ -174,7 +174,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs index ea61a294a465..6d5e8f1779c9 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs @@ -242,7 +242,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Activity.cs index bf0ea857b8b2..6ef65dc03490 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 3eaef3fdb68a..0900bb21d987 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index e2bc7e5c95e3..1ea3cc6d6d13 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Animal.cs index 6b2c354e9d0c..af30b50b1efd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index a3bb92ba8e56..ab4dc8fbae43 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Apple.cs index c0b3b74eccb6..415d977cb273 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index b1a035bf1427..6646379a2ed9 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 8d4e9cf9a280..cf982fbeaccc 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 61678ca8a262..9a0450a54939 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index 5ca882e055d9..946aa81707b4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs index 1734a7d71bbe..35fa5c799fe0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 07d7a0a7ce17..8eb89f28aea2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs index ee17225920da..2144ad665422 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs index 1c2be23372b9..fffbe391d3d5 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); writer.WriteString("pet_type", ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCat.PetType)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs index 55e14e4e7e7d..2cec4e3ee767 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs index 2a75237fd09f..8d25c498e494 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs index cea3eed9a750..5b795e143682 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs index 4386ed6689ff..5b8587c218e1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs index d0974d2d3ae9..82cc312ea062 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Dog.cs index ea0b4d3071f1..8f43963d5b4f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index 0c6925ca0e37..2bf745f2f7d4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index ce7fece13a24..b709630ecb77 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/File.cs index ee5463fb46f9..f3b89016ca8c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index e129b109115f..70c50972598e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Foo.cs index 77a9cd5f82b8..0bde70e7d10c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 73a4dbbcaf22..6f6db2d948a2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 3156ed4239ce..e62347530377 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Fruit.cs index ba5d85932b34..e6781b1c920b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs index 6d9269ff3873..2df46dde14c4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 62dc7cbf449c..4655c9cbb01e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/List.cs index 43d2716ec68c..0ba836f7be5f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8be2841ce1c9..4e22fe711e2a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index b49dc01adc4b..3b1494e797da 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -244,16 +244,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 0c8cceae99d0..90526549ac2b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index a9e0341e6431..2376786bd50e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3229c397c986..415953deb43f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs index d89d53fe55c9..2220371abceb 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index aac8654e884b..e77f1d49f342 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs index 90ac80d193a6..64b5da999734 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs index b487237e70e3..4b84f8966c49 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index 1e08ccc57034..ba9cfa507092 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 047b1dcde4d2..140aba92a7e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 686d151558e0..6f783e7652b9 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 4ec1f5d1af2e..64ca9cee6398 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -282,17 +282,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 42af39d72901..6c679f4eadf0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 696f05a1a694..45bb81479d52 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,17 +1053,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Result.cs index dd616a09ce41..7ed1ea210629 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs index cabc503d20d8..8490dbada03f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index b074a36ee24f..6176113316b0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 3018f5c27f8f..7ac7e71cbc15 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index 07924a0aa49a..88d268f8b94f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs index 9512c15160f5..a5a5f43433ca 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 3a19c8ecaffb..db057bf9b74f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index a5b3a7caf550..e7b97dd14788 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs index e77c43ecd5d4..c5b9db5913dd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a8630ed8db3c..b2ef6e096109 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 15113add0df2..9237807a5896 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs index f3ea6b22b2af..723e1590f152 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 08d6186ad435..2dc6b12e05d8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 6741e280d536..416a3303da1c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Apple.cs index a515b6a46baf..20d70a152cc9 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Fruit.cs index e2e2f33c524d..bf55b771e444 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -250,7 +250,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Activity.cs index bf0ea857b8b2..6ef65dc03490 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 3eaef3fdb68a..0900bb21d987 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index e2bc7e5c95e3..1ea3cc6d6d13 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Animal.cs index 6b2c354e9d0c..af30b50b1efd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index a3bb92ba8e56..ab4dc8fbae43 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Apple.cs index c0b3b74eccb6..415d977cb273 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index b1a035bf1427..6646379a2ed9 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 8d4e9cf9a280..cf982fbeaccc 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 61678ca8a262..9a0450a54939 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 5ca882e055d9..946aa81707b4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs index 1734a7d71bbe..35fa5c799fe0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 07d7a0a7ce17..8eb89f28aea2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs index ee17225920da..2144ad665422 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs index 711470ca3a83..0df505327662 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs index 55e14e4e7e7d..2cec4e3ee767 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs index 73f65a894734..790b30d0598c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -231,9 +231,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs index cea3eed9a750..5b795e143682 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs index 8abf3f5844d0..00e11bca0df2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs index 5484c2ec84ad..3ad11787dcb3 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Dog.cs index ea0b4d3071f1..8f43963d5b4f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index 0c6925ca0e37..2bf745f2f7d4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index e04f4f594f2b..ea948a31b394 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -337,7 +337,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/File.cs index ee5463fb46f9..f3b89016ca8c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index e129b109115f..70c50972598e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Foo.cs index 77a9cd5f82b8..0bde70e7d10c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 73a4dbbcaf22..6f6db2d948a2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 3156ed4239ce..e62347530377 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Fruit.cs index ba5d85932b34..e6781b1c920b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs index 6d9269ff3873..2df46dde14c4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 62dc7cbf449c..4655c9cbb01e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/List.cs index 43d2716ec68c..0ba836f7be5f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8be2841ce1c9..4e22fe711e2a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs index 21cad314eb1d..c216c04d6468 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs @@ -310,16 +310,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 0c8cceae99d0..90526549ac2b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index a9e0341e6431..2376786bd50e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3229c397c986..415953deb43f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs index d89d53fe55c9..2220371abceb 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index aac8654e884b..e77f1d49f342 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs index 90ac80d193a6..64b5da999734 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs index b487237e70e3..4b84f8966c49 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index 1e08ccc57034..ba9cfa507092 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 047b1dcde4d2..140aba92a7e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 686d151558e0..6f783e7652b9 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs index cab3ba9dbf6e..4832f94a4a15 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -371,17 +371,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 42af39d72901..6c679f4eadf0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 01ceaaae2c51..3a80bd868a9b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,17 +2235,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Result.cs index dd616a09ce41..7ed1ea210629 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs index cabc503d20d8..8490dbada03f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index b074a36ee24f..6176113316b0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 3018f5c27f8f..7ac7e71cbc15 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 07924a0aa49a..88d268f8b94f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 9512c15160f5..a5a5f43433ca 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 3a19c8ecaffb..db057bf9b74f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index a5b3a7caf550..e7b97dd14788 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs index 3b7c69765ecd..a28ece650979 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -289,9 +289,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a8630ed8db3c..b2ef6e096109 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 15113add0df2..9237807a5896 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs index f3ea6b22b2af..723e1590f152 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 08d6186ad435..2dc6b12e05d8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index bc1f99da6d94..573b37ce6c98 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,9 +280,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Adult.cs index 199c6bc71de3..7c252ba330b0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -182,13 +182,13 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { if (adult.ChildrenOption.IsSet && adult.Children == null) - throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.Children to non-nullable JSON property 'children'."); if (adult.FirstNameOption.IsSet && adult.FirstName == null) - throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.FirstName to non-nullable JSON property 'firstName'."); if (adult.LastNameOption.IsSet && adult.LastName == null) - throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.LastName to non-nullable JSON property 'lastName'."); if (adult.ChildrenOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs index ce3a88b9d5b7..92932af4440b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -205,10 +205,10 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { if (child.FirstNameOption.IsSet && child.FirstName == null) - throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); if (child.LastNameOption.IsSet && child.LastName == null) - throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.LastName to non-nullable JSON property 'lastName'."); if (child.AgeOption.IsSet) writer.WriteNumber("age", child.AgeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Person.cs index 55e576ab5dab..fea620444347 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Person.cs @@ -241,10 +241,10 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { if (person.FirstNameOption.IsSet && person.FirstName == null) - throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.FirstName to non-nullable JSON property 'firstName'."); if (person.LastNameOption.IsSet && person.LastName == null) - throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.LastName to non-nullable JSON property 'lastName'."); if (person.FirstNameOption.IsSet) writer.WriteString("firstName", person.FirstName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Apple.cs index a515b6a46baf..20d70a152cc9 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs index 0b53a273b3d9..5ccdcf14a13d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -243,7 +243,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs index cc733fa3ac1b..136b36a89958 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs @@ -174,7 +174,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs index ea61a294a465..6d5e8f1779c9 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs @@ -242,7 +242,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Activity.cs index bf0ea857b8b2..6ef65dc03490 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 3eaef3fdb68a..0900bb21d987 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index e2bc7e5c95e3..1ea3cc6d6d13 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Animal.cs index 6b2c354e9d0c..af30b50b1efd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index a3bb92ba8e56..ab4dc8fbae43 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Apple.cs index c0b3b74eccb6..415d977cb273 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index b1a035bf1427..6646379a2ed9 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 8d4e9cf9a280..cf982fbeaccc 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 61678ca8a262..9a0450a54939 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index 5ca882e055d9..946aa81707b4 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs index 1734a7d71bbe..35fa5c799fe0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 07d7a0a7ce17..8eb89f28aea2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs index ee17225920da..2144ad665422 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs index 1c2be23372b9..fffbe391d3d5 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); writer.WriteString("pet_type", ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCat.PetType)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs index 55e14e4e7e7d..2cec4e3ee767 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs index 2a75237fd09f..8d25c498e494 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs index cea3eed9a750..5b795e143682 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs index 4386ed6689ff..5b8587c218e1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs index d0974d2d3ae9..82cc312ea062 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Dog.cs index ea0b4d3071f1..8f43963d5b4f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index 0c6925ca0e37..2bf745f2f7d4 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index ce7fece13a24..b709630ecb77 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/File.cs index ee5463fb46f9..f3b89016ca8c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index e129b109115f..70c50972598e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Foo.cs index 77a9cd5f82b8..0bde70e7d10c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 73a4dbbcaf22..6f6db2d948a2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 3156ed4239ce..e62347530377 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Fruit.cs index ba5d85932b34..e6781b1c920b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs index 6d9269ff3873..2df46dde14c4 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 62dc7cbf449c..4655c9cbb01e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/List.cs index 43d2716ec68c..0ba836f7be5f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8be2841ce1c9..4e22fe711e2a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index b49dc01adc4b..3b1494e797da 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -244,16 +244,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 0c8cceae99d0..90526549ac2b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index a9e0341e6431..2376786bd50e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3229c397c986..415953deb43f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs index d89d53fe55c9..2220371abceb 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index aac8654e884b..e77f1d49f342 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs index 90ac80d193a6..64b5da999734 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs index b487237e70e3..4b84f8966c49 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index 1e08ccc57034..ba9cfa507092 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 047b1dcde4d2..140aba92a7e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 686d151558e0..6f783e7652b9 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 4ec1f5d1af2e..64ca9cee6398 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -282,17 +282,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 42af39d72901..6c679f4eadf0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 696f05a1a694..45bb81479d52 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,17 +1053,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Result.cs index dd616a09ce41..7ed1ea210629 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs index cabc503d20d8..8490dbada03f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index b074a36ee24f..6176113316b0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 3018f5c27f8f..7ac7e71cbc15 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index 07924a0aa49a..88d268f8b94f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs index 9512c15160f5..a5a5f43433ca 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 3a19c8ecaffb..db057bf9b74f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index a5b3a7caf550..e7b97dd14788 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs index e77c43ecd5d4..c5b9db5913dd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a8630ed8db3c..b2ef6e096109 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 15113add0df2..9237807a5896 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs index f3ea6b22b2af..723e1590f152 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 08d6186ad435..2dc6b12e05d8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 6741e280d536..416a3303da1c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Apple.cs index a515b6a46baf..20d70a152cc9 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Fruit.cs index e2e2f33c524d..bf55b771e444 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -250,7 +250,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Activity.cs index bf0ea857b8b2..6ef65dc03490 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 3eaef3fdb68a..0900bb21d987 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index e2bc7e5c95e3..1ea3cc6d6d13 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Animal.cs index 6b2c354e9d0c..af30b50b1efd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index a3bb92ba8e56..ab4dc8fbae43 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Apple.cs index c0b3b74eccb6..415d977cb273 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index b1a035bf1427..6646379a2ed9 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 8d4e9cf9a280..cf982fbeaccc 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 61678ca8a262..9a0450a54939 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 5ca882e055d9..946aa81707b4 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs index 1734a7d71bbe..35fa5c799fe0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 07d7a0a7ce17..8eb89f28aea2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs index ee17225920da..2144ad665422 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs index 711470ca3a83..0df505327662 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs index 55e14e4e7e7d..2cec4e3ee767 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs index 73f65a894734..790b30d0598c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -231,9 +231,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs index cea3eed9a750..5b795e143682 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs index 8abf3f5844d0..00e11bca0df2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs index 5484c2ec84ad..3ad11787dcb3 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Dog.cs index ea0b4d3071f1..8f43963d5b4f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index 0c6925ca0e37..2bf745f2f7d4 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index e04f4f594f2b..ea948a31b394 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -337,7 +337,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/File.cs index ee5463fb46f9..f3b89016ca8c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index e129b109115f..70c50972598e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Foo.cs index 77a9cd5f82b8..0bde70e7d10c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 73a4dbbcaf22..6f6db2d948a2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 3156ed4239ce..e62347530377 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs index ba5d85932b34..e6781b1c920b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs index 6d9269ff3873..2df46dde14c4 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 62dc7cbf449c..4655c9cbb01e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/List.cs index 43d2716ec68c..0ba836f7be5f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8be2841ce1c9..4e22fe711e2a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs index 21cad314eb1d..c216c04d6468 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs @@ -310,16 +310,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 0c8cceae99d0..90526549ac2b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index a9e0341e6431..2376786bd50e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3229c397c986..415953deb43f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs index d89d53fe55c9..2220371abceb 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index aac8654e884b..e77f1d49f342 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs index 90ac80d193a6..64b5da999734 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs index b487237e70e3..4b84f8966c49 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index 1e08ccc57034..ba9cfa507092 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 047b1dcde4d2..140aba92a7e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 686d151558e0..6f783e7652b9 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs index cab3ba9dbf6e..4832f94a4a15 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -371,17 +371,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 42af39d72901..6c679f4eadf0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 01ceaaae2c51..3a80bd868a9b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,17 +2235,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Result.cs index dd616a09ce41..7ed1ea210629 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs index cabc503d20d8..8490dbada03f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index b074a36ee24f..6176113316b0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 3018f5c27f8f..7ac7e71cbc15 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 07924a0aa49a..88d268f8b94f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 9512c15160f5..a5a5f43433ca 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 3a19c8ecaffb..db057bf9b74f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index a5b3a7caf550..e7b97dd14788 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs index 3b7c69765ecd..a28ece650979 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -289,9 +289,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a8630ed8db3c..b2ef6e096109 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 15113add0df2..9237807a5896 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs index f3ea6b22b2af..723e1590f152 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 08d6186ad435..2dc6b12e05d8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index bc1f99da6d94..573b37ce6c98 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,9 +280,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Adult.cs index eb8cbd0b3bc5..4213420714a8 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -184,13 +184,13 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { if (adult.ChildrenOption.IsSet && adult.Children == null) - throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.Children to non-nullable JSON property 'children'."); if (adult.FirstNameOption.IsSet && adult.FirstName == null) - throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.FirstName to non-nullable JSON property 'firstName'."); if (adult.LastNameOption.IsSet && adult.LastName == null) - throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.LastName to non-nullable JSON property 'lastName'."); if (adult.ChildrenOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs index cc9001600c71..4aa344a128f6 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -207,10 +207,10 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { if (child.FirstNameOption.IsSet && child.FirstName == null) - throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); if (child.LastNameOption.IsSet && child.LastName == null) - throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.LastName to non-nullable JSON property 'lastName'."); if (child.AgeOption.IsSet) writer.WriteNumber("age", child.AgeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Person.cs index e5e63ec9c2a5..e65419a3b600 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Person.cs @@ -243,10 +243,10 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { if (person.FirstNameOption.IsSet && person.FirstName == null) - throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.FirstName to non-nullable JSON property 'firstName'."); if (person.LastNameOption.IsSet && person.LastName == null) - throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.LastName to non-nullable JSON property 'lastName'."); if (person.FirstNameOption.IsSet) writer.WriteString("firstName", person.FirstName); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Apple.cs index ba3ebde0806b..e6e5bf9b1853 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs index a552837a0067..9ccac387b196 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -245,7 +245,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs index 6d957f4666fe..ba2d70c2fab5 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs index b23a45484ba3..c7ad4a614836 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs @@ -244,7 +244,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Activity.cs index 8883f1323639..2fb20fd76ba8 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index a7ae93ee504a..a7c053f968ff 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 4c9fc1cad5f2..2d355959392c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Animal.cs index 117be25b4c3f..90faf3ed2ad0 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a61538e1f17..894db21c2542 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Apple.cs index ead5728d626b..8559896f3b99 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index bd8cd61c4221..1096570780ec 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 850a9c376b5a..9a6a9cb6326c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 2e5eb229f1c3..1b911bc1d6c0 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index 2b63506f4b44..e42133d4a724 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs index ea23cb6d7166..57decedb097c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 9ff7be2175c6..0cd7b560fb24 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs index b977a0ca50b9..df8dc6dc03e2 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs index db3c3064f4e2..46fc753b3481 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); writer.WriteString("pet_type", ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCat.PetType)); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs index 4d1213df9a8d..012fb4ea1848 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs index 2a75237fd09f..8d25c498e494 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs index a0a059430fbf..4e0d1370cc9a 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs index 4386ed6689ff..5b8587c218e1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs index d0974d2d3ae9..82cc312ea062 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Dog.cs index e4066eb72582..5d01cd38ebbe 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index fce60664f896..b1c4e76fe748 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index a954055cecef..943f8ad3d406 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/File.cs index e6c3a7cd844f..598363737a5e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 433035256031..74bfbfa1b1ec 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Foo.cs index 9da199ab2477..ab3a41f87790 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 8e9bba64db14..5d64e47dc7f5 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 7c655b0827f2..a00d62ec2e06 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Fruit.cs index ca703d27f96c..a73048ec0ad1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs index c3c2a4e247ab..7071fe00f86d 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index fbd98eae40a9..2f37dd2a61d9 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/List.cs index d6ac694585ca..b65cac7456c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs index e0e39a3acce3..4b1007e9aaf5 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index a416718859af..463b714170dd 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -244,16 +244,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 42247df00c07..57207f29ddb1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index a8f039e97905..c3a43f3fc745 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index c54becfdc303..228d6c3cab98 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs index ec25fab92034..c1fbf300b336 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index a78b4b9ae3a8..d75e2197a1a7 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs index 9135c0e022ad..f4acaf49d8f1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs index e3a0ef4d62fc..fc65064ac4e8 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index b83140b058a7..0c4818c0bff4 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index a6be5066e8cd..56dfe1215b0d 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 994ccd227bef..9fd968c817d6 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs index b94bf16627ff..65396833098d 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -282,17 +282,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 495b0d273f6a..ddd15217fc1f 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index b84dae9064af..16e4165975b4 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,17 +1053,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Result.cs index 3d22bb06491f..b57d0b4c7e8e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs index 184ad3ab12c4..d655ddfb2ce0 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index d67bf5ddc948..e3676b9555c5 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 27c3871866be..22702cfaa178 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index a24895d6f930..edcba4dae388 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs index ce29344d2cdf..879c52edb8a1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 764f36716e27..b48698e26e70 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index d6de3eb2c298..4d1c9e06a24f 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs index e77c43ecd5d4..c5b9db5913dd 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a09ec60e3535..5bd2ec9a6bba 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index e023fb8f77fc..0ca59c6ad79b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs index dc078c480cbc..cf3e65aa1327 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 02655307d760..9f99606b7fa8 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 449736faed56..61583d889dad 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs index 4103a73cd4f0..d43c6780ca28 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index adf86a28dcd0..23f5c4b3a85d 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 2c52c15ccdcc..ad641f68f2e9 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -336,25 +336,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs index b5e2ed9ae27f..6344d530cd6e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs @@ -223,7 +223,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs index ffbd21ce4a6a..866888eb836c 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs index 0f80dc0d9c03..edd6e65f1f41 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs @@ -253,13 +253,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs index a43c764f8240..5091186fdbdc 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -188,9 +188,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index aef7d7e481d8..509645c3f350 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 93684cf9efc6..9d5c27336962 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs index 0b5b6d24743d..14d7950c4b6f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -223,13 +223,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs index a19a8488e044..8dbfb7552b5f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs index eb14befa97d3..68e8220438eb 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs @@ -293,22 +293,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs index b1fedb233db5..0759faaf06af 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -179,7 +179,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs index 97e28530372b..4101d46d205f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -195,9 +195,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs index d99184db6550..d7c5a4cd96ec 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs @@ -238,7 +238,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs index a7666cfb698a..16551511b256 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index cbc3e80b4a27..e1e504b538e1 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs index 77fc65981096..260d78873e2e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -233,9 +233,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs index 6ee21a0298c9..ed6bc6534338 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 0490d964f022..5e4782e9741b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs index b78ed38fc503..68a2f65c9aff 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs index d4c4e6c2273c..5a130166a0b1 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs index 6908fb106b63..b8435f95759c 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs @@ -179,10 +179,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs index 74c2e0ae5d4b..cce96329e588 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs @@ -240,10 +240,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs index 3bcb6d9b4888..8fa2f6d57739 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,7 +339,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index bf25136ce8d5..407e33a7b6f5 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs index 668ebfa6c77c..6608c8f2c0e0 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index b29be867e838..d8837421dcac 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs index 98e50928aae1..4b75918a83d5 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 763577d494c8..baa4b149818a 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs index d7ca66d7495a..0291786cf4e5 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -953,32 +953,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs index ec0062ba20d3..f902f78034c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs index 039f5faedfc4..1eccb13e9003 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs @@ -238,7 +238,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 6fa1889a08bd..1a446ca46e5a 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -241,10 +241,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 962e2a3c1294..82b78a3e00f9 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -339,22 +339,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index fac6f52f2522..b211cf0586b1 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs index aac40319978e..b8a8a257d0d2 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 027d4fde6be0..70963bef2fc5 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs index 3c7e075d574e..64474ff0d16d 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs @@ -312,16 +312,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 71af55e64992..48eca2b1e0b8 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs index 1536ccf00030..e5c9f6f2f2f7 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index d7d6068bcd10..175027917ad1 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -258,7 +258,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs index 7f178b026301..77c1611f8f80 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs index 2d6852d12c7e..f79e2eac8d8f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs index 0e9021c907a6..b32d7f964146 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs index d54d7b7d29b5..5d7ca65e2a70 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -283,7 +283,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 2e206a226911..10c8125b1068 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -191,9 +191,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs index ea88ed18b540..d1327d7b480f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs @@ -410,10 +410,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index c858d1b3727b..1007be70c886 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -249,13 +249,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs index 6ed3bf816867..bdd0db7f40e9 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -223,7 +223,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs index 6cd3a02b4296..b9556e0402d0 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -373,17 +373,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 33061272899b..bbd3a56b31ed 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index bb29062628a7..3b1999efb42d 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs index d1f6c6f40209..f8f5a836850e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2237,17 +2237,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs index 17f97f2387a3..a6bef2efe103 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs @@ -226,13 +226,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs index 02b3fdc639e2..aeaa9fe0d2c2 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -234,11 +234,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs index affe88bd8aea..56e323eb1cc8 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index ed0af26e87fb..55d774689f49 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index ada72abaf3ad..f1779050584b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs index 7d55af95627a..cb375197e488 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 48481ee56dfe..0034604725d0 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs index 7af87418b89f..4d3a32498644 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs index fbc5d4a9829e..ed520154f099 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index dc66551a230d..182412d38e32 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index f297317601df..97b4b270f1c9 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs index c9e049a3db72..5b568b36e9ec 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -291,9 +291,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 32e069929830..07d98ed51393 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs index 1edb92ec63a9..19455a837c65 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs @@ -225,10 +225,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs index 9fbc6b8085b5..c97244ab95ff 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs index 50de52ddebec..7c8a73e2ca82 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -426,25 +426,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs index 00e53f6dc690..a855f0431854 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -218,9 +218,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs index a871ad34d76d..a9f35d0bd260 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs @@ -282,9 +282,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Apple.cs index ba3ebde0806b..e6e5bf9b1853 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Fruit.cs index 1a4743015087..af45459bafc7 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -252,7 +252,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs index 8883f1323639..2fb20fd76ba8 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index a7ae93ee504a..a7c053f968ff 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 4c9fc1cad5f2..2d355959392c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Animal.cs index 117be25b4c3f..90faf3ed2ad0 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a61538e1f17..894db21c2542 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Apple.cs index ead5728d626b..8559896f3b99 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index bd8cd61c4221..1096570780ec 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 850a9c376b5a..9a6a9cb6326c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 2e5eb229f1c3..1b911bc1d6c0 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 2b63506f4b44..e42133d4a724 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs index ea23cb6d7166..57decedb097c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 9ff7be2175c6..0cd7b560fb24 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs index b977a0ca50b9..df8dc6dc03e2 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs index aad251c4d9e7..d5e2a907d867 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs index 4d1213df9a8d..012fb4ea1848 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs index 73f65a894734..790b30d0598c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -231,9 +231,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs index a0a059430fbf..4e0d1370cc9a 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs index 8abf3f5844d0..00e11bca0df2 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs index 5484c2ec84ad..3ad11787dcb3 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Dog.cs index e4066eb72582..5d01cd38ebbe 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index fce60664f896..b1c4e76fe748 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index 45da2f7dc94c..bc284aa6ef5d 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -337,7 +337,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/File.cs index e6c3a7cd844f..598363737a5e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 433035256031..74bfbfa1b1ec 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Foo.cs index 9da199ab2477..ab3a41f87790 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 8e9bba64db14..5d64e47dc7f5 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 7c655b0827f2..a00d62ec2e06 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs index ca703d27f96c..a73048ec0ad1 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs index c3c2a4e247ab..7071fe00f86d 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index fbd98eae40a9..2f37dd2a61d9 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/List.cs index d6ac694585ca..b65cac7456c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs index e0e39a3acce3..4b1007e9aaf5 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs index 41b65bf5bc38..b5cdc783088c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs @@ -310,16 +310,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 42247df00c07..57207f29ddb1 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index a8f039e97905..c3a43f3fc745 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index c54becfdc303..228d6c3cab98 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs index ec25fab92034..c1fbf300b336 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index a78b4b9ae3a8..d75e2197a1a7 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs index 9135c0e022ad..f4acaf49d8f1 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs index e3a0ef4d62fc..fc65064ac4e8 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index b83140b058a7..0c4818c0bff4 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index a6be5066e8cd..56dfe1215b0d 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 994ccd227bef..9fd968c817d6 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 41de214278b4..a95f55c8bee3 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -371,17 +371,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 495b0d273f6a..ddd15217fc1f 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index bda0936c7e46..697eb747f6ec 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,17 +2235,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Result.cs index 3d22bb06491f..b57d0b4c7e8e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs index 184ad3ab12c4..d655ddfb2ce0 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index d67bf5ddc948..e3676b9555c5 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 27c3871866be..22702cfaa178 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index a24895d6f930..edcba4dae388 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs index ce29344d2cdf..879c52edb8a1 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 764f36716e27..b48698e26e70 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index d6de3eb2c298..4d1c9e06a24f 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs index 3b7c69765ecd..a28ece650979 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -289,9 +289,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a09ec60e3535..5bd2ec9a6bba 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index e023fb8f77fc..0ca59c6ad79b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs index dc078c480cbc..cf3e65aa1327 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 02655307d760..9f99606b7fa8 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 26ed2ec21c31..476487740ff7 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,9 +280,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs index 80dce6546255..14a5655c8023 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index b609046e8738..06c18ced2a1c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index cd282ab084bb..d4e0bd11b830 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -337,25 +337,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs index 2fa4fe8d9972..6861539d48cb 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs @@ -224,7 +224,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs index f0ae4ef850cb..ff9b64de4fe5 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -224,10 +224,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs index edbe669c8994..ed26f278fc46 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs @@ -254,13 +254,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs index 0b270e3d4ebb..505491f73869 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 6351ae775d17..270d77309df1 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index f1d13b9ea264..c2fbcd6a7e57 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs index 6fe159c3a522..877795d5cfd4 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs index 04f114d2c52d..d2b0f9fc8e45 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs index b1ad2e90a31e..26ea3730fba7 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs @@ -294,22 +294,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs index 306e5e5f4010..4231f2c01135 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -180,7 +180,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs index 60daf384a42b..33ec2ed9905d 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -196,9 +196,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs index 61e9f0c189bc..77c923435187 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs @@ -239,7 +239,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs index 187afe4824bb..90236769cb4a 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index a7184463a89b..d1828daed8ba 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs index b5df3dc0625e..7c1c3f7fe287 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -234,9 +234,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs index 130e644a578d..94e9213fe899 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 06763ca2d13c..4b96563e3461 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs index 4547aa00e1c6..48aba268c5b9 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs index 5c2a73bce3fd..aae60577a78f 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs index ad6546f5ed2e..f43fe465b65a 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs @@ -180,10 +180,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs index c842739103d3..d26192a1adba 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs @@ -241,10 +241,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs index ec67776ec0a4..d07f1518f6ce 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -340,7 +340,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index c10e5ccee004..a4d6ad4c2f68 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/File.cs index ddeebaa52e17..c26fe4f172ce 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/File.cs @@ -179,7 +179,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index d90772377b69..77eeacd1bfce 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs index c0fff6bbf2db..a26bca0b15d4 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index b0493a92bcf0..23d6edaccb8c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs index a2a69a9962fb..50a33f2580bf 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,32 +954,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs index 9bad6c70417c..b9adf9d71cc8 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs @@ -222,7 +222,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs index 2dff0e74d24c..a2198a7ec32a 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs @@ -239,7 +239,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 716fb2ec240c..098874540247 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -242,10 +242,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 4682d88e6894..f14013f65705 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -340,22 +340,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index d936a509fa55..261267b6c02f 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/List.cs index 0af9622c0f0c..d6cd61b8668e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/List.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 0b811f15795c..3de1c9b7ebc5 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs index 57ff0614c54e..a8ff51c976de 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs @@ -313,16 +313,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 93d9cddbe354..93b19a688f74 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2f853d145282..f79216144534 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index da7a9e873433..e75d3ba0ffc5 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -259,7 +259,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs index 3ee3e91634c4..e9036f7546d3 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs index 8ed7851b3215..44a323173884 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs index bac5b01c0825..357ce5b2d143 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs index 56ab59544304..fc70dd80cb4d 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -284,7 +284,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 8f71e4492518..358f13e8de5f 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -192,9 +192,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs index b24440849590..5bf7c08c2823 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs @@ -411,10 +411,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 3602dfda1310..62fccbbcc8a0 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -250,13 +250,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs index 0c0d0abd343f..9791bf2027d3 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -224,7 +224,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs index ad57645de2f5..b91b50503d72 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -374,17 +374,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 63195ad709ae..ac2b8e61cd67 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index b411dc6e9d33..8a93f3022a91 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs index 41a2c79c34d6..3ba198d8e0bd 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2238,17 +2238,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs index 02d0d8c34c20..5e2d71377d97 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs @@ -227,13 +227,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs index 6ac928d7c6b8..ef308616828c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -235,11 +235,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 9c544ea876ee..1d07de3a4b45 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index b1122b96b779..e292a138c48e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 6e5cff7d75a8..9e866915b32f 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs index 94079e588b26..5aedd501c226 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 794c35454611..e7ed21a8c3ca 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs index 1e1b860dedd7..345cd905709a 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs index df7dabd4bbb6..7f53fa7ebbbd 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index b42fcd243ecc..508388831ad1 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 5e985a42157a..cdd78842b091 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs index 6b0ee1bbe913..7410185d15aa 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -292,9 +292,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 9c65047ab818..41fcb61c7c76 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs index d935ee12b186..2ef0d0971d77 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs @@ -226,10 +226,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs index 78caa9c95ad1..20b576d5efbd 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs index 01aeeb13e1de..ea4bce9e000e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -427,25 +427,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs index 89658a5314c9..f66ffed7581c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -219,9 +219,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs index 3d814ffc0b00..d5e1f9506697 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs @@ -283,9 +283,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs index eb8cbd0b3bc5..4213420714a8 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -184,13 +184,13 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { if (adult.ChildrenOption.IsSet && adult.Children == null) - throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.Children to non-nullable JSON property 'children'."); if (adult.FirstNameOption.IsSet && adult.FirstName == null) - throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.FirstName to non-nullable JSON property 'firstName'."); if (adult.LastNameOption.IsSet && adult.LastName == null) - throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); + throw new JsonException("Cannot write null property Adult.LastName to non-nullable JSON property 'lastName'."); if (adult.ChildrenOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs index cc9001600c71..4aa344a128f6 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -207,10 +207,10 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { if (child.FirstNameOption.IsSet && child.FirstName == null) - throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); if (child.LastNameOption.IsSet && child.LastName == null) - throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); + throw new JsonException("Cannot write null property Child.LastName to non-nullable JSON property 'lastName'."); if (child.AgeOption.IsSet) writer.WriteNumber("age", child.AgeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Person.cs index e5e63ec9c2a5..e65419a3b600 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Person.cs @@ -243,10 +243,10 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { if (person.FirstNameOption.IsSet && person.FirstName == null) - throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.FirstName to non-nullable JSON property 'firstName'."); if (person.LastNameOption.IsSet && person.LastName == null) - throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); + throw new JsonException("Cannot write null property Person.LastName to non-nullable JSON property 'lastName'."); if (person.FirstNameOption.IsSet) writer.WriteString("firstName", person.FirstName); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Apple.cs index ba3ebde0806b..e6e5bf9b1853 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs index a552837a0067..9ccac387b196 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -245,7 +245,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs index 6d957f4666fe..ba2d70c2fab5 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs index b23a45484ba3..c7ad4a614836 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs @@ -244,7 +244,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs index 8883f1323639..2fb20fd76ba8 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index a7ae93ee504a..a7c053f968ff 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 4c9fc1cad5f2..2d355959392c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Animal.cs index 117be25b4c3f..90faf3ed2ad0 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a61538e1f17..894db21c2542 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Apple.cs index ead5728d626b..8559896f3b99 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index bd8cd61c4221..1096570780ec 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 850a9c376b5a..9a6a9cb6326c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 2e5eb229f1c3..1b911bc1d6c0 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs index 2b63506f4b44..e42133d4a724 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs index ea23cb6d7166..57decedb097c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 9ff7be2175c6..0cd7b560fb24 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs index b977a0ca50b9..df8dc6dc03e2 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs index db3c3064f4e2..46fc753b3481 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); writer.WriteString("pet_type", ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCat.PetType)); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs index 4d1213df9a8d..012fb4ea1848 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs index 2a75237fd09f..8d25c498e494 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivityAllOfSchemaValueConverter.ToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs index a0a059430fbf..4e0d1370cc9a 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs index 4386ed6689ff..5b8587c218e1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Descendant1.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs index d0974d2d3ae9..82cc312ea062 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Descendant2.cs @@ -175,12 +175,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Dog.cs index e4066eb72582..5d01cd38ebbe 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs index fce60664f896..b1c4e76fe748 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index a954055cecef..943f8ad3d406 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/File.cs index e6c3a7cd844f..598363737a5e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 433035256031..74bfbfa1b1ec 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Foo.cs index 9da199ab2477..ab3a41f87790 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 8e9bba64db14..5d64e47dc7f5 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index 7c655b0827f2..a00d62ec2e06 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Fruit.cs index ca703d27f96c..a73048ec0ad1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs index c3c2a4e247ab..7071fe00f86d 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index fbd98eae40a9..2f37dd2a61d9 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/List.cs index d6ac694585ca..b65cac7456c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs index e0e39a3acce3..4b1007e9aaf5 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs index a416718859af..463b714170dd 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -244,16 +244,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 42247df00c07..57207f29ddb1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs index a8f039e97905..c3a43f3fc745 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index c54becfdc303..228d6c3cab98 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs index ec25fab92034..c1fbf300b336 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index a78b4b9ae3a8..d75e2197a1a7 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs index 9135c0e022ad..f4acaf49d8f1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs index e3a0ef4d62fc..fc65064ac4e8 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs index b83140b058a7..0c4818c0bff4 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index a6be5066e8cd..56dfe1215b0d 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 994ccd227bef..9fd968c817d6 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs index b94bf16627ff..65396833098d 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -282,17 +282,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 495b0d273f6a..ddd15217fc1f 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index b84dae9064af..16e4165975b4 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,17 +1053,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Result.cs index 3d22bb06491f..b57d0b4c7e8e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs index 184ad3ab12c4..d655ddfb2ce0 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index d67bf5ddc948..e3676b9555c5 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 27c3871866be..22702cfaa178 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index a24895d6f930..edcba4dae388 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs index ce29344d2cdf..879c52edb8a1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 764f36716e27..b48698e26e70 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index d6de3eb2c298..4d1c9e06a24f 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs index e77c43ecd5d4..c5b9db5913dd 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendantsObjectTypeValueConverter.ToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a09ec60e3535..5bd2ec9a6bba 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index e023fb8f77fc..0ca59c6ad79b 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs index dc078c480cbc..cf3e65aa1327 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 02655307d760..9f99606b7fa8 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 449736faed56..61583d889dad 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs index 4103a73cd4f0..d43c6780ca28 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index adf86a28dcd0..23f5c4b3a85d 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 2c52c15ccdcc..ad641f68f2e9 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -336,25 +336,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs index b5e2ed9ae27f..6344d530cd6e 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs @@ -223,7 +223,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs index ffbd21ce4a6a..866888eb836c 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs index 0f80dc0d9c03..edd6e65f1f41 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs @@ -253,13 +253,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs index a43c764f8240..5091186fdbdc 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -188,9 +188,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index aef7d7e481d8..509645c3f350 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 93684cf9efc6..9d5c27336962 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs index 0b5b6d24743d..14d7950c4b6f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -223,13 +223,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs index a19a8488e044..8dbfb7552b5f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs index eb14befa97d3..68e8220438eb 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs @@ -293,22 +293,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs index b1fedb233db5..0759faaf06af 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -179,7 +179,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs index 97e28530372b..4101d46d205f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -195,9 +195,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs index d99184db6550..d7c5a4cd96ec 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs @@ -238,7 +238,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs index a7666cfb698a..16551511b256 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index cbc3e80b4a27..e1e504b538e1 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs index 77fc65981096..260d78873e2e 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -233,9 +233,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs index 6ee21a0298c9..ed6bc6534338 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 0490d964f022..5e4782e9741b 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs index b78ed38fc503..68a2f65c9aff 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant1.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs index d4c4e6c2273c..5a130166a0b1 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Descendant2.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs index 6908fb106b63..b8435f95759c 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs @@ -179,10 +179,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs index 74c2e0ae5d4b..cce96329e588 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs @@ -240,10 +240,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs index 3bcb6d9b4888..8fa2f6d57739 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,7 +339,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index bf25136ce8d5..407e33a7b6f5 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs index 668ebfa6c77c..6608c8f2c0e0 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index b29be867e838..d8837421dcac 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs index 98e50928aae1..4b75918a83d5 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 763577d494c8..baa4b149818a 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs index d7ca66d7495a..0291786cf4e5 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -953,32 +953,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs index ec0062ba20d3..f902f78034c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs index 039f5faedfc4..1eccb13e9003 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs @@ -238,7 +238,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 6fa1889a08bd..1a446ca46e5a 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -241,10 +241,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 962e2a3c1294..82b78a3e00f9 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -339,22 +339,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index fac6f52f2522..b211cf0586b1 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -184,12 +184,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs index aac40319978e..b8a8a257d0d2 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 027d4fde6be0..70963bef2fc5 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -200,10 +200,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs index 3c7e075d574e..64474ff0d16d 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs @@ -312,16 +312,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 71af55e64992..48eca2b1e0b8 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs index 1536ccf00030..e5c9f6f2f2f7 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index d7d6068bcd10..175027917ad1 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -258,7 +258,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs index 7f178b026301..77c1611f8f80 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs index 2d6852d12c7e..f79e2eac8d8f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs index 0e9021c907a6..b32d7f964146 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs index d54d7b7d29b5..5d7ca65e2a70 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -283,7 +283,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 2e206a226911..10c8125b1068 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -191,9 +191,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs index ea88ed18b540..d1327d7b480f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs @@ -410,10 +410,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index c858d1b3727b..1007be70c886 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -249,13 +249,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs index 6ed3bf816867..bdd0db7f40e9 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -223,7 +223,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs index 6cd3a02b4296..b9556e0402d0 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -373,17 +373,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 33061272899b..bbd3a56b31ed 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index bb29062628a7..3b1999efb42d 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs index d1f6c6f40209..f8f5a836850e 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2237,17 +2237,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs index 17f97f2387a3..a6bef2efe103 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Result.cs @@ -226,13 +226,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs index 02b3fdc639e2..aeaa9fe0d2c2 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -234,11 +234,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs index affe88bd8aea..56e323eb1cc8 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index ed0af26e87fb..55d774689f49 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index ada72abaf3ad..f1779050584b 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs index 7d55af95627a..cb375197e488 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 48481ee56dfe..0034604725d0 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -191,12 +191,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs index 7af87418b89f..4d3a32498644 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs index fbc5d4a9829e..ed520154f099 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -200,7 +200,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index dc66551a230d..182412d38e32 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index f297317601df..97b4b270f1c9 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs index c9e049a3db72..5b568b36e9ec 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -291,9 +291,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 32e069929830..07d98ed51393 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs index 1edb92ec63a9..19455a837c65 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs @@ -225,10 +225,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs index 9fbc6b8085b5..c97244ab95ff 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -172,9 +172,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs index 50de52ddebec..7c8a73e2ca82 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -426,25 +426,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs index 00e53f6dc690..a855f0431854 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -218,9 +218,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs index a871ad34d76d..a9f35d0bd260 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs @@ -282,9 +282,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Apple.cs index ba3ebde0806b..e6e5bf9b1853 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.KindOption.IsSet && apple.Kind == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Kind to non-nullable JSON property 'kind'."); if (apple.KindOption.IsSet) writer.WriteString("kind", apple.Kind); diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Fruit.cs index 1a4743015087..af45459bafc7 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -252,7 +252,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs index 8883f1323639..2fb20fd76ba8 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index a7ae93ee504a..a7c053f968ff 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 4c9fc1cad5f2..2d355959392c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Animal.cs index 117be25b4c3f..90faf3ed2ad0 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a61538e1f17..894db21c2542 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Apple.cs index ead5728d626b..8559896f3b99 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index bd8cd61c4221..1096570780ec 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 850a9c376b5a..9a6a9cb6326c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 2e5eb229f1c3..1b911bc1d6c0 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 2b63506f4b44..e42133d4a724 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs index ea23cb6d7166..57decedb097c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 9ff7be2175c6..0cd7b560fb24 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs index b977a0ca50b9..df8dc6dc03e2 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs index aad251c4d9e7..d5e2a907d867 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs index 4d1213df9a8d..012fb4ea1848 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs index 73f65a894734..790b30d0598c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -231,9 +231,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs index a0a059430fbf..4e0d1370cc9a 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs index 8abf3f5844d0..00e11bca0df2 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs index 5484c2ec84ad..3ad11787dcb3 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Dog.cs index e4066eb72582..5d01cd38ebbe 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index fce60664f896..b1c4e76fe748 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index 45da2f7dc94c..bc284aa6ef5d 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -337,7 +337,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/File.cs index e6c3a7cd844f..598363737a5e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 433035256031..74bfbfa1b1ec 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Foo.cs index 9da199ab2477..ab3a41f87790 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 8e9bba64db14..5d64e47dc7f5 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 7c655b0827f2..a00d62ec2e06 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Fruit.cs index ca703d27f96c..a73048ec0ad1 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs index c3c2a4e247ab..7071fe00f86d 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index fbd98eae40a9..2f37dd2a61d9 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/List.cs index d6ac694585ca..b65cac7456c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs index e0e39a3acce3..4b1007e9aaf5 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs index 41b65bf5bc38..b5cdc783088c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs @@ -310,16 +310,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 42247df00c07..57207f29ddb1 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index a8f039e97905..c3a43f3fc745 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index c54becfdc303..228d6c3cab98 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs index ec25fab92034..c1fbf300b336 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index a78b4b9ae3a8..d75e2197a1a7 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs index 9135c0e022ad..f4acaf49d8f1 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs index e3a0ef4d62fc..fc65064ac4e8 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index b83140b058a7..0c4818c0bff4 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index a6be5066e8cd..56dfe1215b0d 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 994ccd227bef..9fd968c817d6 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 41de214278b4..a95f55c8bee3 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -371,17 +371,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 495b0d273f6a..ddd15217fc1f 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index bda0936c7e46..697eb747f6ec 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,17 +2235,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Result.cs index 3d22bb06491f..b57d0b4c7e8e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs index 184ad3ab12c4..d655ddfb2ce0 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index d67bf5ddc948..e3676b9555c5 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 27c3871866be..22702cfaa178 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index a24895d6f930..edcba4dae388 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs index ce29344d2cdf..879c52edb8a1 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 764f36716e27..b48698e26e70 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index d6de3eb2c298..4d1c9e06a24f 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs index 3b7c69765ecd..a28ece650979 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -289,9 +289,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a09ec60e3535..5bd2ec9a6bba 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index e023fb8f77fc..0ca59c6ad79b 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs index dc078c480cbc..cf3e65aa1327 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 02655307d760..9f99606b7fa8 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 26ed2ec21c31..476487740ff7 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,9 +280,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs index 80dce6546255..14a5655c8023 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index b609046e8738..06c18ced2a1c 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index cd282ab084bb..d4e0bd11b830 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -337,25 +337,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs index 2fa4fe8d9972..6861539d48cb 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs @@ -224,7 +224,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs index f0ae4ef850cb..ff9b64de4fe5 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -224,10 +224,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs index edbe669c8994..ed26f278fc46 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs @@ -254,13 +254,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs index 0b270e3d4ebb..505491f73869 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 6351ae775d17..270d77309df1 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index f1d13b9ea264..c2fbcd6a7e57 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs index 6fe159c3a522..877795d5cfd4 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs index 04f114d2c52d..d2b0f9fc8e45 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs index b1ad2e90a31e..26ea3730fba7 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs @@ -294,22 +294,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs index 306e5e5f4010..4231f2c01135 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -180,7 +180,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs index 60daf384a42b..33ec2ed9905d 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -196,9 +196,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs index 61e9f0c189bc..77c923435187 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs @@ -239,7 +239,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs index 187afe4824bb..90236769cb4a 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index a7184463a89b..d1828daed8ba 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs index b5df3dc0625e..7c1c3f7fe287 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -234,9 +234,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs index 130e644a578d..94e9213fe899 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 06763ca2d13c..4b96563e3461 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs index 4547aa00e1c6..48aba268c5b9 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Descendant1.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs index 5c2a73bce3fd..aae60577a78f 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Descendant2.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs index ad6546f5ed2e..f43fe465b65a 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs @@ -180,10 +180,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs index c842739103d3..d26192a1adba 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs @@ -241,10 +241,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs index ec67776ec0a4..d07f1518f6ce 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -340,7 +340,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index c10e5ccee004..a4d6ad4c2f68 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/File.cs index ddeebaa52e17..c26fe4f172ce 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/File.cs @@ -179,7 +179,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index d90772377b69..77eeacd1bfce 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs index c0fff6bbf2db..a26bca0b15d4 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index b0493a92bcf0..23d6edaccb8c 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs index a2a69a9962fb..50a33f2580bf 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,32 +954,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs index 9bad6c70417c..b9adf9d71cc8 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs @@ -222,7 +222,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs index 2dff0e74d24c..a2198a7ec32a 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs @@ -239,7 +239,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 716fb2ec240c..098874540247 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -242,10 +242,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 4682d88e6894..f14013f65705 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -340,22 +340,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index d936a509fa55..261267b6c02f 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -185,12 +185,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/List.cs index 0af9622c0f0c..d6cd61b8668e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/List.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 0b811f15795c..3de1c9b7ebc5 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -201,10 +201,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs index 57ff0614c54e..a8ff51c976de 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs @@ -313,16 +313,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 93d9cddbe354..93b19a688f74 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs index 2f853d145282..f79216144534 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index da7a9e873433..e75d3ba0ffc5 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -259,7 +259,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs index 3ee3e91634c4..e9036f7546d3 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs index 8ed7851b3215..44a323173884 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs index bac5b01c0825..357ce5b2d143 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs index 56ab59544304..fc70dd80cb4d 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -284,7 +284,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 8f71e4492518..358f13e8de5f 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -192,9 +192,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs index b24440849590..5bf7c08c2823 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs @@ -411,10 +411,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 3602dfda1310..62fccbbcc8a0 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -250,13 +250,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs index 0c0d0abd343f..9791bf2027d3 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -224,7 +224,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs index ad57645de2f5..b91b50503d72 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -374,17 +374,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 63195ad709ae..ac2b8e61cd67 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index b411dc6e9d33..8a93f3022a91 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs index 41a2c79c34d6..3ba198d8e0bd 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2238,17 +2238,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs index 02d0d8c34c20..5e2d71377d97 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Result.cs @@ -227,13 +227,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs index 6ac928d7c6b8..ef308616828c 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -235,11 +235,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 9c544ea876ee..1d07de3a4b45 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index b1122b96b779..e292a138c48e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 6e5cff7d75a8..9e866915b32f 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs index 94079e588b26..5aedd501c226 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 794c35454611..e7ed21a8c3ca 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -192,12 +192,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs index 1e1b860dedd7..345cd905709a 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs index df7dabd4bbb6..7f53fa7ebbbd 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -201,7 +201,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index b42fcd243ecc..508388831ad1 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 5e985a42157a..cdd78842b091 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs index 6b0ee1bbe913..7410185d15aa 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -292,9 +292,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 9c65047ab818..41fcb61c7c76 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -178,7 +178,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs index d935ee12b186..2ef0d0971d77 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs @@ -226,10 +226,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs index 78caa9c95ad1..20b576d5efbd 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -173,9 +173,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs index 01aeeb13e1de..ea4bce9e000e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -427,25 +427,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs index 89658a5314c9..f66ffed7581c 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -219,9 +219,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs index 3d814ffc0b00..d5e1f9506697 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs @@ -283,9 +283,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Activity.cs index bf0ea857b8b2..6ef65dc03490 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + throw new JsonException("Cannot write null property Activity.ActivityOutputs to non-nullable JSON property 'activity_outputs'."); if (activity.ActivityOutputsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 3eaef3fdb68a..0900bb21d987 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop1 to non-nullable JSON property 'prop1'."); if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + throw new JsonException("Cannot write null property ActivityOutputElementRepresentation.Prop2 to non-nullable JSON property 'prop2'."); if (activityOutputElementRepresentation.Prop1Option.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index e2bc7e5c95e3..1ea3cc6d6d13 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -334,25 +334,25 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.EmptyMap to non-nullable JSON property 'empty_map'."); if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapOfMapProperty to non-nullable JSON property 'map_of_map_property'."); if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapProperty to non-nullable JSON property 'map_property'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 to non-nullable JSON property 'map_with_undeclared_properties_anytype_1'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 to non-nullable JSON property 'map_with_undeclared_properties_anytype_2'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 to non-nullable JSON property 'map_with_undeclared_properties_anytype_3'."); if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + throw new JsonException("Cannot write null property AdditionalPropertiesClass.MapWithUndeclaredPropertiesString to non-nullable JSON property 'map_with_undeclared_properties_string'."); if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Animal.cs index 6b2c354e9d0c..af30b50b1efd 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Animal.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { if (animal.ColorOption.IsSet && animal.Color == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + throw new JsonException("Cannot write null property Animal.Color to non-nullable JSON property 'color'."); writer.WriteString("className", animal.ClassName); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index a3bb92ba8e56..ab4dc8fbae43 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -221,10 +221,10 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + throw new JsonException("Cannot write null property ApiResponse.Type to non-nullable JSON property 'type'."); if (apiResponse.CodeOption.IsSet) writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Apple.cs index c0b3b74eccb6..415d977cb273 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Apple.cs @@ -251,13 +251,13 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.ColorCode to non-nullable JSON property 'color_code'."); if (apple.CultivarOption.IsSet && apple.Cultivar == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Cultivar to non-nullable JSON property 'cultivar'."); if (apple.OriginOption.IsSet && apple.Origin == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + throw new JsonException("Cannot write null property Apple.Origin to non-nullable JSON property 'origin'."); if (apple.ColorCodeOption.IsSet) writer.WriteString("color_code", apple.ColorCode); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index b1a035bf1427..6646379a2ed9 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,9 +186,6 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(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.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 8d4e9cf9a280..cf982fbeaccc 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfArrayOfNumberOnly.ArrayArrayNumber to non-nullable JSON property 'ArrayArrayNumber'."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 61678ca8a262..9a0450a54939 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + throw new JsonException("Cannot write null property ArrayOfNumberOnly.ArrayNumber to non-nullable JSON property 'ArrayNumber'."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs index 5ca882e055d9..946aa81707b4 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -221,13 +221,13 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfInteger to non-nullable JSON property 'array_array_of_integer'."); if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayArrayOfModel to non-nullable JSON property 'array_array_of_model'."); if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + throw new JsonException("Cannot write null property ArrayTest.ArrayOfString to non-nullable JSON property 'array_of_string'."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs index d8187db4ad9f..da8a396dd208 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs index 1734a7d71bbe..35fa5c799fe0 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs @@ -291,22 +291,22 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.ATT_NAME to non-nullable JSON property 'ATT_NAME'."); if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalCamel to non-nullable JSON property 'CapitalCamel'."); if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.CapitalSnake to non-nullable JSON property 'Capital_Snake'."); if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SCAETHFlowPoints to non-nullable JSON property 'SCA_ETH_Flow_Points'."); if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallCamel to non-nullable JSON property 'smallCamel'."); if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + throw new JsonException("Cannot write null property Capitalization.SmallSnake to non-nullable JSON property 'small_Snake'."); if (capitalization.ATT_NAMEOption.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 07d7a0a7ce17..8eb89f28aea2 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -177,7 +177,7 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { if (cat.ColorOption.IsSet && cat.Color == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); writer.WriteString("className", cat.ClassName); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs index ee17225920da..2144ad665422 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,9 +193,6 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs index 711470ca3a83..0df505327662 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { if (childCat.NameOption.IsSet && childCat.Name == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + throw new JsonException("Cannot write null property ChildCat.Name to non-nullable JSON property 'name'."); if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs index 55e14e4e7e7d..2cec4e3ee767 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { if (classModel.ClassOption.IsSet && classModel.Class == null) - throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + throw new JsonException("Cannot write null property ClassModel.Class to non-nullable JSON property '_class'."); if (classModel.ClassOption.IsSet) writer.WriteString("_class", classModel.Class); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 675cea7e9800..71f28630fcd3 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs index 73f65a894734..790b30d0598c 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/CopyActivity.cs @@ -231,9 +231,6 @@ public override void Write(Utf8JsonWriter writer, CopyActivity copyActivity, Jso /// public void WriteProperties(Utf8JsonWriter writer, CopyActivity copyActivity, JsonSerializerOptions jsonSerializerOptions) { - if (copyActivity.CopyActivitytt == null) - throw new ArgumentNullException(nameof(copyActivity.CopyActivitytt), "Property is required for class CopyActivity."); - writer.WriteString("copyActivitytt", copyActivity.CopyActivitytt); writer.WriteString("$schema", CopyActivity.SchemaEnumToJsonValue(copyActivity.Schema)); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs index e1321fb84673..36182d9cbb8e 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs index cea3eed9a750..5b795e143682 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + throw new JsonException("Cannot write null property DeprecatedObject.Name to non-nullable JSON property 'name'."); if (deprecatedObject.NameOption.IsSet) writer.WriteString("name", deprecatedObject.Name); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs index 8abf3f5844d0..00e11bca0df2 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Descendant1.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant1 descendant1, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant1 descendant1, JsonSerializerOptions jsonSerializerOptions) { - if (descendant1.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant1.AlternativeName), "Property is required for class Descendant1."); - - if (descendant1.DescendantName == null) - throw new ArgumentNullException(nameof(descendant1.DescendantName), "Property is required for class Descendant1."); - writer.WriteString("alternativeName", descendant1.AlternativeName); writer.WriteString("descendantName", descendant1.DescendantName); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs index 5484c2ec84ad..3ad11787dcb3 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Descendant2.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, Descendant2 descendant2, JsonS /// public void WriteProperties(Utf8JsonWriter writer, Descendant2 descendant2, JsonSerializerOptions jsonSerializerOptions) { - if (descendant2.AlternativeName == null) - throw new ArgumentNullException(nameof(descendant2.AlternativeName), "Property is required for class Descendant2."); - - if (descendant2.Confidentiality == null) - throw new ArgumentNullException(nameof(descendant2.Confidentiality), "Property is required for class Descendant2."); - writer.WriteString("alternativeName", descendant2.AlternativeName); writer.WriteString("confidentiality", descendant2.Confidentiality); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Dog.cs index ea0b4d3071f1..8f43963d5b4f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Dog.cs @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { if (dog.BreedOption.IsSet && dog.Breed == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Breed to non-nullable JSON property 'breed'."); if (dog.ColorOption.IsSet && dog.Color == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + throw new JsonException("Cannot write null property Dog.Color to non-nullable JSON property 'color'."); writer.WriteString("className", dog.ClassName); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Drawing.cs index 0c6925ca0e37..2bf745f2f7d4 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -238,10 +238,10 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.MainShape to non-nullable JSON property 'mainShape'."); if (drawing.ShapesOption.IsSet && drawing.Shapes == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + throw new JsonException("Cannot write null property Drawing.Shapes to non-nullable JSON property 'shapes'."); if (drawing.MainShapeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index e04f4f594f2b..ea948a31b394 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -337,7 +337,7 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); if (enumArrays.ArrayEnumOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index a7ae4b88717c..6945fabbfb86 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/File.cs index ee5463fb46f9..f3b89016ca8c 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/File.cs @@ -176,7 +176,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { if (file.SourceURIOption.IsSet && file.SourceURI == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + throw new JsonException("Cannot write null property File.SourceURI to non-nullable JSON property 'sourceURI'."); if (file.SourceURIOption.IsSet) writer.WriteString("sourceURI", file.SourceURI); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index e129b109115f..70c50972598e 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.File to non-nullable JSON property 'file'."); if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + throw new JsonException("Cannot write null property FileSchemaTestClass.Files to non-nullable JSON property 'files'."); if (fileSchemaTestClass.FileOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Foo.cs index 77a9cd5f82b8..0bde70e7d10c 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Foo.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { if (foo.BarOption.IsSet && foo.Bar == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + throw new JsonException("Cannot write null property Foo.Bar to non-nullable JSON property 'bar'."); if (foo.BarOption.IsSet) writer.WriteString("bar", foo.Bar); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 73a4dbbcaf22..6f6db2d948a2 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + throw new JsonException("Cannot write null property FooGetDefaultResponse.String to non-nullable JSON property 'string'."); if (fooGetDefaultResponse.StringOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index 3156ed4239ce..e62347530377 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -951,32 +951,26 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.Byte == null) - throw new ArgumentNullException(nameof(formatTest.Byte), "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."); + throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName2), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) - throw new ArgumentNullException(nameof(formatTest.DuplicatePropertyName), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigits to non-nullable JSON property 'pattern_with_digits'."); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.PatternWithDigitsAndDelimiter to non-nullable JSON property 'pattern_with_digits_and_delimiter'."); if (formatTest.StringOption.IsSet && formatTest.String == null) - throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Fruit.cs index ba5d85932b34..e6781b1c920b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Fruit.cs @@ -219,7 +219,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { if (fruit.ColorOption.IsSet && fruit.Color == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + throw new JsonException("Cannot write null property Fruit.Color to non-nullable JSON property 'color'."); if (fruit.ColorOption.IsSet) writer.WriteString("color", fruit.Color); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs index 6d9269ff3873..2df46dde14c4 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -236,7 +236,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + throw new JsonException("Cannot write null property GmFruit.Color to non-nullable JSON property 'color'."); if (gmFruit.ColorOption.IsSet) writer.WriteString("color", gmFruit.Color); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index af770d67c662..925dfb5ff515 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -239,10 +239,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Bar to non-nullable JSON property 'bar'."); if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + throw new JsonException("Cannot write null property HasOnlyReadOnly.Foo to non-nullable JSON property 'foo'."); if (hasOnlyReadOnly.BarOption.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs index 62dc7cbf449c..4655c9cbb01e 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/InjectedVendorExtensionsTest.cs @@ -337,22 +337,22 @@ public override void Write(Utf8JsonWriter writer, InjectedVendorExtensionsTest i public void WriteProperties(Utf8JsonWriter writer, InjectedVendorExtensionsTest injectedVendorExtensionsTest, JsonSerializerOptions jsonSerializerOptions) { if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor to non-nullable JSON property 'potentiallyOverriddenPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternalOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToInternal to non-nullable JSON property 'potentiallyOverriddenPropertyToInternal'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivateOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPrivate to non-nullable JSON property 'potentiallyOverriddenPropertyToPrivate'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublicOption.IsSet && injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.PotentiallyOverriddenPropertyToPublic to non-nullable JSON property 'potentiallyOverriddenPropertyToPublic'."); if (injectedVendorExtensionsTest.UnalteredPropertyOption.IsSet && injectedVendorExtensionsTest.UnalteredProperty == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredProperty), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredProperty to non-nullable JSON property 'unalteredProperty'."); if (injectedVendorExtensionsTest.UnalteredPropertyAccessorOption.IsSet && injectedVendorExtensionsTest.UnalteredPropertyAccessor == null) - throw new ArgumentNullException(nameof(injectedVendorExtensionsTest.UnalteredPropertyAccessor), "Property is required for class InjectedVendorExtensionsTest."); + throw new JsonException("Cannot write null property InjectedVendorExtensionsTest.UnalteredPropertyAccessor to non-nullable JSON property 'unalteredPropertyAccessor'."); if (injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessorOption.IsSet) writer.WriteString("potentiallyOverriddenPropertyAccessor", injectedVendorExtensionsTest.PotentiallyOverriddenPropertyAccessor); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f48f46edb14a..9e34531ab9ba 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -182,12 +182,6 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/List.cs index 43d2716ec68c..0ba836f7be5f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/List.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { if (list.Var123ListOption.IsSet && list.Var123List == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + throw new JsonException("Cannot write null property List.Var123List to non-nullable JSON property '123-list'."); if (list.Var123ListOption.IsSet) writer.WriteString("123-list", list.Var123List); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8be2841ce1c9..4e22fe711e2a 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -198,10 +198,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.EscapedLiteralString to non-nullable JSON property 'escapedLiteralString'."); if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + throw new JsonException("Cannot write null property LiteralStringClass.UnescapedLiteralString to non-nullable JSON property 'unescapedLiteralString'."); if (literalStringClass.EscapedLiteralStringOption.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MapTest.cs index 21cad314eb1d..c216c04d6468 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MapTest.cs @@ -310,16 +310,16 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.DirectMap to non-nullable JSON property 'direct_map'."); if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.IndirectMap to non-nullable JSON property 'indirect_map'."); if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapMapOfString to non-nullable JSON property 'map_map_of_string'."); if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + throw new JsonException("Cannot write null property MapTest.MapOfEnumString to non-nullable JSON property 'map_of_enum_string'."); if (mapTest.DirectMapOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs index 0c8cceae99d0..90526549ac2b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) - throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + throw new JsonException("Cannot write null property MixedAnyOf.Content to non-nullable JSON property 'content'."); if (mixedAnyOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs index a9e0341e6431..2376786bd50e 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) { if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) - throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + throw new JsonException("Cannot write null property MixedOneOf.Content to non-nullable JSON property 'content'."); if (mixedOneOf.ContentOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3229c397c986..415953deb43f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -256,7 +256,7 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs index d89d53fe55c9..2220371abceb 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSer public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) { if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) - throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + throw new JsonException("Cannot write null property MixedSubId.Id to non-nullable JSON property 'id'."); if (mixedSubId.IdOption.IsSet) writer.WriteString("id", mixedSubId.Id); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index aac8654e884b..e77f1d49f342 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { if (model200Response.ClassOption.IsSet && model200Response.Class == null) - throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs index 90ac80d193a6..64b5da999734 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + throw new JsonException("Cannot write null property ModelClient.VarClient to non-nullable JSON property 'client'."); if (modelClient.VarClientOption.IsSet) writer.WriteString("client", modelClient.VarClient); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs index b487237e70e3..4b84f8966c49 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -281,7 +281,7 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { if (name.PropertyOption.IsSet && name.Property == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); writer.WriteNumber("name", name.VarName); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 173109b5fa48..2858e8d86e69 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -189,9 +189,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs index 1e08ccc57034..ba9cfa507092 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -408,10 +408,10 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ArrayItemsNullable to non-nullable JSON property 'array_items_nullable'."); if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + throw new JsonException("Cannot write null property NullableClass.ObjectItemsNullable to non-nullable JSON property 'object_items_nullable'."); if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 047b1dcde4d2..140aba92a7e8 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -247,13 +247,13 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Bars to non-nullable JSON property 'bars'."); if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); if (objectWithDeprecatedFields.BarsOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 686d151558e0..6f783e7652b9 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -221,7 +221,7 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); if (outerComposite.MyBooleanOption.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs index cab3ba9dbf6e..4832f94a4a15 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -371,17 +371,11 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(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.CategoryOption.IsSet && pet.Category == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); if (pet.TagsOption.IsSet && pet.Tags == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); writer.WriteString("name", pet.Name); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 8a448cd3387c..790693a4ee03 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 42af39d72901..6c679f4eadf0 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -236,10 +236,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Bar to non-nullable JSON property 'bar'."); if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + throw new JsonException("Cannot write null property ReadOnlyFirst.Baz to non-nullable JSON property 'baz'."); if (readOnlyFirst.BarOption.IsSet) writer.WriteString("bar", readOnlyFirst.Bar); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 01ceaaae2c51..3a80bd868a9b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,17 +2235,11 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(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."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Result.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Result.cs index dd616a09ce41..7ed1ea210629 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Result.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Result.cs @@ -224,13 +224,13 @@ public override void Write(Utf8JsonWriter writer, Result result, JsonSerializerO public void WriteProperties(Utf8JsonWriter writer, Result result, JsonSerializerOptions jsonSerializerOptions) { if (result.CodeOption.IsSet && result.Code == null) - throw new ArgumentNullException(nameof(result.Code), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Code to non-nullable JSON property 'code'."); if (result.DataOption.IsSet && result.Data == null) - throw new ArgumentNullException(nameof(result.Data), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Data to non-nullable JSON property 'data'."); if (result.UuidOption.IsSet && result.Uuid == null) - throw new ArgumentNullException(nameof(result.Uuid), "Property is required for class Result."); + throw new JsonException("Cannot write null property Result.Uuid to non-nullable JSON property 'uuid'."); if (result.CodeOption.IsSet) writer.WriteString("code", result.Code); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs index cabc503d20d8..8490dbada03f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,11 +232,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.Lock == null) - throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); - if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) - throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); writer.WriteString("lock", varReturn.Lock); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index b074a36ee24f..6176113316b0 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); if (rolesReportsHash.RoleOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 3018f5c27f8f..7ac7e71cbc15 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + throw new JsonException("Cannot write null property RolesReportsHashRole.Name to non-nullable JSON property 'name'."); if (rolesReportsHashRole.NameOption.IsSet) writer.WriteString("name", rolesReportsHashRole.Name); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 90e3ddf5efa3..fc2982004601 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs index a1070f6b741a..54079932ecbf 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 06867abbfabe..45ef5585c1a2 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -189,12 +189,6 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 07924a0aa49a..88d268f8b94f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 9512c15160f5..a5a5f43433ca 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -198,7 +198,7 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { if (tag.NameOption.IsSet && tag.Name == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); if (tag.IdOption.IsSet) writer.WriteNumber("id", tag.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 3a19c8ecaffb..db057bf9b74f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordList.Value to non-nullable JSON property 'value'."); if (testCollectionEndingWithWordList.ValueOption.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index a5b3a7caf550..e7b97dd14788 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + throw new JsonException("Cannot write null property TestCollectionEndingWithWordListObject.TestCollectionEndingWithWordList to non-nullable JSON property 'TestCollectionEndingWithWordList'."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs index 3b7c69765ecd..a28ece650979 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestDescendants.cs @@ -289,9 +289,6 @@ public override void Write(Utf8JsonWriter writer, TestDescendants testDescendant /// public void WriteProperties(Utf8JsonWriter writer, TestDescendants testDescendants, JsonSerializerOptions jsonSerializerOptions) { - if (testDescendants.AlternativeName == null) - throw new ArgumentNullException(nameof(testDescendants.AlternativeName), "Property is required for class TestDescendants."); - writer.WriteString("alternativeName", testDescendants.AlternativeName); writer.WriteString("objectType", TestDescendants.ObjectTypeEnumToJsonValue(testDescendants.ObjectType)); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index a8630ed8db3c..b2ef6e096109 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -175,7 +175,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + throw new JsonException("Cannot write null property TestInlineFreeformAdditionalPropertiesRequest.SomeProperty to non-nullable JSON property 'someProperty'."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 15113add0df2..9237807a5896 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -223,10 +223,10 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { if (testResult.DataOption.IsSet && testResult.Data == null) - throw new ArgumentNullException(nameof(testResult.Data), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); if (testResult.UuidOption.IsSet && testResult.Uuid == null) - throw new ArgumentNullException(nameof(testResult.Uuid), "Property is required for class TestResult."); + throw new JsonException("Cannot write null property TestResult.Uuid to non-nullable JSON property 'uuid'."); if (testResult.CodeOption.IsSet) { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs index 4774a8af8087..afe9457b01a5 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -170,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(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/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs index f3ea6b22b2af..723e1590f152 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -424,25 +424,25 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { if (user.EmailOption.IsSet && user.Email == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Email to non-nullable JSON property 'email'."); if (user.FirstNameOption.IsSet && user.FirstName == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); if (user.LastNameOption.IsSet && user.LastName == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + throw new JsonException("Cannot write null property User.ObjectWithNoDeclaredProps to non-nullable JSON property 'objectWithNoDeclaredProps'."); if (user.PasswordOption.IsSet && user.Password == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Password to non-nullable JSON property 'password'."); if (user.PhoneOption.IsSet && user.Phone == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); if (user.UsernameOption.IsSet && user.Username == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 08d6186ad435..2dc6b12e05d8 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,9 +216,6 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(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.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index bc1f99da6d94..573b37ce6c98 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,9 +280,6 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(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.TypeOption.Value.Value); From a8bf04bbd678d7d974dc5da0d21d84015e9f0345 Mon Sep 17 00:00:00 2001 From: devhl Date: Sat, 12 Sep 2026 00:31:33 -0400 Subject: [PATCH 2/2] validate all not nullable and not required --- .../generichost/JsonConverter.mustache | 2 - .../Org.OpenAPITools/Model/OneOfNullAndRef.cs | 3 ++ .../Model/OneOfNullAndRef2.cs | 3 ++ .../Model/OneOfNullAndRef3.cs | 3 ++ .../src/Org.OpenAPITools/Model/Parent.cs | 3 ++ .../Model/ParentWithOneOfProperty.cs | 3 ++ .../src/Org.OpenAPITools/Model/Color.cs | 9 ++++ .../Org.OpenAPITools/Model/NullTypeDirect.cs | 3 ++ .../src/Org.OpenAPITools/Model/Shape.cs | 3 ++ .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 6 +++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Orange.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../Model/NowGet200Response.cs | 6 +++ .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 6 +++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Orange.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../Model/NowGet200Response.cs | 6 +++ .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 6 +++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Orange.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../Model/NowGet200Response.cs | 6 +++ .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 6 +++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Orange.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../Model/NowGet200Response.cs | 6 +++ .../AllOf/src/Org.OpenAPITools/Model/Child.cs | 6 +++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/Orange.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ .../Model/NowGet200Response.cs | 6 +++ .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 ++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Banana.cs | 3 ++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 ++ .../src/Org.OpenAPITools/Model/Cat.cs | 3 ++ .../src/Org.OpenAPITools/Model/Category.cs | 3 ++ .../Org.OpenAPITools/Model/DateOnlyClass.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 21 ++++++++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 48 +++++++++++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 9 ++++ .../Model/Model200Response.cs | 3 ++ .../src/Org.OpenAPITools/Model/Name.cs | 6 +++ .../src/Org.OpenAPITools/Model/NumberOnly.cs | 3 ++ .../Model/ObjectWithDeprecatedFields.cs | 3 ++ .../src/Org.OpenAPITools/Model/Order.cs | 18 +++++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 6 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 6 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 27 +++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 3 ++ .../Model/RolesReportsHash.cs | 3 ++ .../Model/SpecialModelName.cs | 3 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 3 ++ .../src/Org.OpenAPITools/Model/TestResult.cs | 3 ++ .../src/Org.OpenAPITools/Model/User.cs | 6 +++ .../src/Org.OpenAPITools/Model/Whale.cs | 6 +++ .../src/Org.OpenAPITools/Model/Zebra.cs | 3 ++ .../Model/ZeroBasedEnumClass.cs | 3 ++ 544 files changed, 3879 insertions(+), 2 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 e97c5c610076..53c8ad62704c 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 @@ -455,13 +455,11 @@ {{#allVars}} {{^isDiscriminator}} {{^isNullable}} - {{#vendorExtensions.x-is-reference-type}} {{^required}} if ({{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}}Option.IsSet && {{#lambda.camelcase_sanitize_param}}{{classname}}{{/lambda.camelcase_sanitize_param}}.{{name}} == null) throw new JsonException("Cannot write null property {{classname}}.{{name}} to non-nullable JSON property '{{baseName}}'."); {{/required}} - {{/vendorExtensions.x-is-reference-type}} {{/isNullable}} {{/isDiscriminator}} {{/allVars}} diff --git a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef.cs b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef.cs index 2c365d4b4b3b..afc16caa901c 100644 --- a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef.cs +++ b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef.cs @@ -168,6 +168,9 @@ public override void Write(Utf8JsonWriter writer, OneOfNullAndRef oneOfNullAndRe /// public void WriteProperties(Utf8JsonWriter writer, OneOfNullAndRef oneOfNullAndRef, JsonSerializerOptions jsonSerializerOptions) { + if (oneOfNullAndRef.NumberOption.IsSet && oneOfNullAndRef.Number == null) + throw new JsonException("Cannot write null property OneOfNullAndRef.Number to non-nullable JSON property 'number'."); + if (oneOfNullAndRef.NumberOption.IsSet) { var numberRawValue = NumberValueConverter.ToJsonValue(oneOfNullAndRef.Number!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef2.cs b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef2.cs index 305d1256e5aa..b93625d3a510 100644 --- a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef2.cs +++ b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef2.cs @@ -168,6 +168,9 @@ public override void Write(Utf8JsonWriter writer, OneOfNullAndRef2 oneOfNullAndR /// public void WriteProperties(Utf8JsonWriter writer, OneOfNullAndRef2 oneOfNullAndRef2, JsonSerializerOptions jsonSerializerOptions) { + if (oneOfNullAndRef2.NumberOption.IsSet && oneOfNullAndRef2.Number == null) + throw new JsonException("Cannot write null property OneOfNullAndRef2.Number to non-nullable JSON property 'number'."); + if (oneOfNullAndRef2.NumberOption.IsSet) { var numberRawValue = NumberValueConverter.ToJsonValue(oneOfNullAndRef2.Number!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef3.cs b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef3.cs index 3eee3a0cc0a3..9ade8f157f5a 100644 --- a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef3.cs +++ b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/OneOfNullAndRef3.cs @@ -168,6 +168,9 @@ public override void Write(Utf8JsonWriter writer, OneOfNullAndRef3 oneOfNullAndR /// public void WriteProperties(Utf8JsonWriter writer, OneOfNullAndRef3 oneOfNullAndRef3, JsonSerializerOptions jsonSerializerOptions) { + if (oneOfNullAndRef3.NumberOption.IsSet && oneOfNullAndRef3.Number == null) + throw new JsonException("Cannot write null property OneOfNullAndRef3.Number to non-nullable JSON property 'number'."); + if (oneOfNullAndRef3.NumberOption.IsSet) { var numberRawValue = NumberValueConverter.ToJsonValue(oneOfNullAndRef3.Number!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/Parent.cs b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/Parent.cs index d80195837703..d2fd6566d8f4 100644 --- a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/Parent.cs +++ b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/Parent.cs @@ -168,6 +168,9 @@ public override void Write(Utf8JsonWriter writer, Parent parent, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Parent parent, JsonSerializerOptions jsonSerializerOptions) { + if (parent.NumberOption.IsSet && parent.Number == null) + throw new JsonException("Cannot write null property Parent.Number to non-nullable JSON property 'number'."); + if (parent.NumberOption.IsSet) { var numberRawValue = NumberValueConverter.ToJsonValue(parent.Number!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/ParentWithOneOfProperty.cs b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/ParentWithOneOfProperty.cs index 01da36ff5bb5..af064bac4e56 100644 --- a/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/ParentWithOneOfProperty.cs +++ b/samples/client/petstore/csharp/generichost/latest/AnnotatedEnum/src/Org.OpenAPITools/Model/ParentWithOneOfProperty.cs @@ -168,6 +168,9 @@ public override void Write(Utf8JsonWriter writer, ParentWithOneOfProperty parent /// public void WriteProperties(Utf8JsonWriter writer, ParentWithOneOfProperty parentWithOneOfProperty, JsonSerializerOptions jsonSerializerOptions) { + if (parentWithOneOfProperty.NumberOption.IsSet && parentWithOneOfProperty.Number == null) + throw new JsonException("Cannot write null property ParentWithOneOfProperty.Number to non-nullable JSON property 'number'."); + if (parentWithOneOfProperty.NumberOption.IsSet) { var numberRawValue = NumberValueConverter.ToJsonValue(parentWithOneOfProperty.Number!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Color.cs b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Color.cs index 43acd7237bd3..392bf310549c 100644 --- a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Color.cs +++ b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Color.cs @@ -250,6 +250,15 @@ public override void Write(Utf8JsonWriter writer, Color color, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Color color, JsonSerializerOptions jsonSerializerOptions) { + if (color.BOption.IsSet && color.B == null) + throw new JsonException("Cannot write null property Color.B to non-nullable JSON property 'b'."); + + if (color.GOption.IsSet && color.G == null) + throw new JsonException("Cannot write null property Color.G to non-nullable JSON property 'g'."); + + if (color.ROption.IsSet && color.R == null) + throw new JsonException("Cannot write null property Color.R to non-nullable JSON property 'r'."); + if (color.BOption.IsSet) writer.WriteNumber("b", color.BOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/NullTypeDirect.cs b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/NullTypeDirect.cs index 0d1f337a2103..cb668927b471 100644 --- a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/NullTypeDirect.cs +++ b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/NullTypeDirect.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, NullTypeDirect nullTypeDirect, /// public void WriteProperties(Utf8JsonWriter writer, NullTypeDirect nullTypeDirect, JsonSerializerOptions jsonSerializerOptions) { + if (nullTypeDirect.IdOption.IsSet && nullTypeDirect.Id == null) + throw new JsonException("Cannot write null property NullTypeDirect.Id to non-nullable JSON property 'id'."); + if (nullTypeDirect.AlwaysNullOption.IsSet) if (nullTypeDirect.AlwaysNullOption.Value != null) { diff --git a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs index 10881800c2e4..877158311288 100644 --- a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/Shape.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { + if (shape.AreaOption.IsSet && shape.Area == null) + throw new JsonException("Cannot write null property Shape.Area to non-nullable JSON property 'area'."); + writer.WriteString("shapeType", shape.ShapeType); if (shape.AreaOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs index a0f026d80cd3..9fc58e50b835 100644 --- a/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/generichost/latest/NullTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { + if (shapeOrNull.AreaOption.IsSet && shapeOrNull.Area == null) + throw new JsonException("Cannot write null property ShapeOrNull.Area to non-nullable JSON property 'area'."); + writer.WriteString("shapeType", shapeOrNull.ShapeType); if (shapeOrNull.AreaOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ApiResponse.cs index 28e98de7e92e..2d955bed2864 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -214,6 +214,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AppleReq.cs index 2aacb278a4d4..7ede1db8aae9 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/AppleReq.cs @@ -187,6 +187,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Banana.cs index b4f9eb670952..ee06386ed18c 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Banana.cs @@ -168,6 +168,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/BananaReq.cs index 458545e6f8e6..94e303e4efb5 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/BananaReq.cs @@ -187,6 +187,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Cat.cs index f46fd29e6908..274069876c4a 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Cat.cs @@ -180,6 +180,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Category.cs index ea3a6ea302a6..ef51987c7c78 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Category.cs @@ -187,6 +187,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DateOnlyClass.cs index efd5329632ab..e40843855a80 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs index 659d58160163..496fd8e72f03 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -333,6 +333,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumTest.cs index 03b929699774..52b718fd0fcb 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/EnumTest.cs @@ -869,6 +869,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FormatTest.cs index 33eac5e64a20..899c764ca96f 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/FormatTest.cs @@ -948,12 +948,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -966,6 +1002,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3cbcbb3908ed..68918f31043d 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -249,9 +249,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Model200Response.cs index a83c22abd0e2..ddb067055bee 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Model200Response.cs @@ -194,6 +194,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Name.cs index 13e1f5d09f0f..b597041faf5f 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Name.cs @@ -236,6 +236,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NumberOnly.cs index d672c4557978..2d5b1da808c7 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -168,6 +168,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 2cc87c1fbb20..d12f94ab19b1 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -246,6 +246,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Order.cs index d912397ce446..0c163e7f8f9a 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Order.cs @@ -378,6 +378,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/OuterComposite.cs index 3e6c81901f4b..29073f0450ad 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -214,6 +214,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Pet.cs index 1daeda083e0c..6f040eb931cd 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Pet.cs @@ -368,6 +368,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RequiredClass.cs index 255f94aa5249..e5db62fc1ee8 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2229,12 +2229,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Return.cs index 7c9fcad64d64..464879e9f26c 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Return.cs @@ -226,6 +226,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 69c97d82b5b8..469134c26bde 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -194,6 +194,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SpecialModelName.cs index 898f8ebce963..98289ad7a6e6 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -194,6 +194,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Tag.cs index 16d4fafd3403..34992e8815bb 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Tag.cs @@ -191,6 +191,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestResult.cs index 874fcdfaf351..b89dacf27aa0 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/TestResult.cs @@ -216,6 +216,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/User.cs index c6567fbbde5e..b3c25d6eae7d 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/User.cs @@ -423,6 +423,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -435,6 +438,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Whale.cs index 2c1da03ee7ae..c4e8f3daa18d 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Whale.cs @@ -210,6 +210,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Zebra.cs index 94895fe9757f..3c1a11d437d7 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/Zebra.cs @@ -281,6 +281,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 21a8e68af61f..a81ccef21b06 100644 --- a/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -241,6 +241,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Child.cs index 4aa344a128f6..f71f244652dc 100644 --- a/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net10/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -206,6 +206,12 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { + if (child.AgeOption.IsSet && child.Age == null) + throw new JsonException("Cannot write null property Child.Age to non-nullable JSON property 'age'."); + + if (child.BoosterSeatOption.IsSet && child.BoosterSeat == null) + throw new JsonException("Cannot write null property Child.BoosterSeat to non-nullable JSON property 'boosterSeat'."); + if (child.FirstNameOption.IsSet && child.FirstName == null) throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index ddd75420f237..65dc4a02463e 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index b31f8fe51330..7b0cc8bc8756 100644 --- a/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net10/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -175,6 +175,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 894db21c2542..332e1e100ce2 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 1096570780ec..cc81766fcebe 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Banana.cs index 40d370fd1cdb..d887a45c931e 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index 0673de456831..db3b3f2aabd1 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 0cd7b560fb24..f3f27956ed3b 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Category.cs index df8dc6dc03e2..d78edc3ee72c 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 2b1f5670dec1..72a7565ec3c6 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index 943f8ad3d406..ee70392a1686 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs index cab43b30299d..780950460e89 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs @@ -351,6 +351,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index a00d62ec2e06..b489e77a1e15 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 228d6c3cab98..1d5a4defe637 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index d75e2197a1a7..bb2913f5df66 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Name.cs index fc65064ac4e8..19757fa1c327 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index 21b40632deb7..428f234deaeb 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 56dfe1215b0d..d8bd9f36ea39 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Order.cs index 79cfaaf0e5bf..66edef8216f7 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -295,6 +295,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 9fd968c817d6..93be59d99690 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 65396833098d..f60a0987b590 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -285,6 +285,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 16e4165975b4..eeda5ef0fcc7 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,12 +1053,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Return.cs index d655ddfb2ce0..c4b5b9636bb3 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index e3676b9555c5..9b73fae206ff 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index edcba4dae388..9b3bfdab8bcf 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Tag.cs index 879c52edb8a1..9ac1082f742a 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 0ca59c6ad79b..5abf98b1e65b 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/User.cs index cf3e65aa1327..90deb77dbaaa 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 9f99606b7fa8..1cdb5bad9dd1 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 61583d889dad..67b6d90eb1d7 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 9add0a06d4cc..ad7eadb1b479 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet) { var zeroBasedEnumRawValue = ZeroBasedEnumClassZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs index 866888eb836c..70585c8acf5b 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs index 5091186fdbdc..a98f5bd8787f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -188,6 +188,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs index fab250f7b537..0a7d794e23fc 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs index 42e9d1890af1..1973db4c4bed 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs @@ -188,6 +188,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs index 0759faaf06af..0f47bd35e784 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -181,6 +181,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs index 4101d46d205f..d411efbb83bd 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -195,6 +195,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs index c04c4f439bdf..f39aa601716f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -182,6 +182,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs index 8fa2f6d57739..05f5e7db1d24 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -341,6 +341,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs index 647002803b89..62c8f51ce807 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs @@ -877,6 +877,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs index 0291786cf4e5..1badd1c0d948 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -956,12 +956,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -974,6 +1010,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 175027917ad1..1cef2917ba78 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -257,9 +257,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs index f79e2eac8d8f..ff4080153aea 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs index 5d7ca65e2a70..8fd568be1a6b 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -285,6 +285,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs index fa2f63c11abf..a463ed4572d3 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 1007be70c886..03727598207c 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -254,6 +254,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs index ac6f4585d259..ee4d0c85d40a 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs @@ -386,6 +386,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs index bdd0db7f40e9..686aa2d77797 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -222,6 +222,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs index b9556e0402d0..5c16160c5db9 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -376,6 +376,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs index f8f5a836850e..1912f3c24ebf 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2237,12 +2237,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs index aeaa9fe0d2c2..fd9446247331 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -234,6 +234,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 56e323eb1cc8..ac6dd43ef0b2 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs index 4d3a32498644..81c58c98aa68 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs index ed520154f099..a16ea726bfff 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -199,6 +199,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs index 19455a837c65..d168aff8b9c2 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs @@ -224,6 +224,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs index 7c8a73e2ca82..c6a4d2cddb86 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -431,6 +431,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -443,6 +446,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs index a855f0431854..74e3afd8dbf8 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -218,6 +218,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs index a9f35d0bd260..f6faea2fd5ed 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs @@ -282,6 +282,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 5e17279cd925..796310e1783f 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -249,6 +249,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Banana.cs index ddd75420f237..65dc4a02463e 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Orange.cs b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Orange.cs index 02e5aab13a27..793f5553239f 100644 --- a/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Orange.cs +++ b/samples/client/petstore/csharp/generichost/net10/OneOf/src/Org.OpenAPITools/Model/Orange.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Orange orange, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Orange orange, JsonSerializerOptions jsonSerializerOptions) { + if (orange.SweetOption.IsSet && orange.Sweet == null) + throw new JsonException("Cannot write null property Orange.Sweet to non-nullable JSON property 'sweet'."); + if (orange.SweetOption.IsSet) writer.WriteBoolean("sweet", orange.SweetOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 894db21c2542..332e1e100ce2 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 1096570780ec..cc81766fcebe 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Banana.cs index 40d370fd1cdb..d887a45c931e 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index 0673de456831..db3b3f2aabd1 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 0cd7b560fb24..f3f27956ed3b 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Category.cs index df8dc6dc03e2..d78edc3ee72c 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 2b1f5670dec1..72a7565ec3c6 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index bc284aa6ef5d..231e6fbbf6bc 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,6 +339,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 62d913a7c0d7..0aaa3e6fe0aa 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -875,6 +875,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index a00d62ec2e06..b489e77a1e15 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 228d6c3cab98..1d5a4defe637 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index d75e2197a1a7..bb2913f5df66 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Name.cs index fc65064ac4e8..19757fa1c327 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 21b40632deb7..428f234deaeb 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 56dfe1215b0d..d8bd9f36ea39 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Order.cs index 43827461cc02..d3f99122b153 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -384,6 +384,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 9fd968c817d6..93be59d99690 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Pet.cs index a95f55c8bee3..6d3d8121e68c 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -374,6 +374,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 697eb747f6ec..50d69fccab91 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,12 +2235,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Return.cs index d655ddfb2ce0..c4b5b9636bb3 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index e3676b9555c5..9b73fae206ff 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index edcba4dae388..9b3bfdab8bcf 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 879c52edb8a1..9ac1082f742a 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 0ca59c6ad79b..5abf98b1e65b 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/User.cs index cf3e65aa1327..90deb77dbaaa 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 9f99606b7fa8..1cdb5bad9dd1 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 476487740ff7..8bd6f70f0a95 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,6 +280,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 18dfbaafaf8c..0f0d25e333db 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs index ff9b64de4fe5..6895b23c9654 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -223,6 +223,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs index 505491f73869..95c14d25d542 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs index c35241ce3891..fd95bd629bbe 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs index 5639dd362d9b..afdff1b19be1 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs index 4231f2c01135..c44fc9083169 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -182,6 +182,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs index 33ec2ed9905d..9795a7beec1b 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -196,6 +196,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 38bca8c661f8..60ef9165d975 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -183,6 +183,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs index d07f1518f6ce..5c6eccf09721 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -342,6 +342,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs index 534039c94588..57e8cd61d373 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs @@ -878,6 +878,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs index 50a33f2580bf..bc64a259b1eb 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -957,12 +957,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -975,6 +1011,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index e75d3ba0ffc5..2a2d05afb5bf 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -258,9 +258,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs index 44a323173884..4538cb6884df 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs index fc70dd80cb4d..37f41d119044 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -286,6 +286,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs index 46933a2fbf95..b051d11b1761 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 62fccbbcc8a0..e041d875bc51 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -255,6 +255,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs index c4a7ebd764c5..5a9d1362547d 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs @@ -387,6 +387,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs index 9791bf2027d3..4a94f026f474 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -223,6 +223,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs index b91b50503d72..4e7c71f8a59d 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -377,6 +377,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs index 3ba198d8e0bd..599aa94d5e5e 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2238,12 +2238,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs index ef308616828c..36c27ec413ed 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -235,6 +235,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 1d07de3a4b45..bbaefb23e8b7 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs index 345cd905709a..edf8a9edcacf 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs index 7f53fa7ebbbd..a5f86d17a002 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -200,6 +200,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs index 2ef0d0971d77..eee7fb7736e2 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs @@ -225,6 +225,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/User.cs index ea4bce9e000e..2589af030b24 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -432,6 +432,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -444,6 +447,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs index f66ffed7581c..a55ad54be20d 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -219,6 +219,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs index d5e1f9506697..143976f6b272 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs @@ -283,6 +283,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 98e4d7afdbfd..733adac3c5c4 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -250,6 +250,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index 7027a58c996a..f8d7a66197ae 100644 --- a/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net10/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -201,6 +201,12 @@ public override void Write(Utf8JsonWriter writer, NowGet200Response nowGet200Res /// public void WriteProperties(Utf8JsonWriter writer, NowGet200Response nowGet200Response, JsonSerializerOptions jsonSerializerOptions) { + if (nowGet200Response.NowOption.IsSet && nowGet200Response.Now == null) + throw new JsonException("Cannot write null property NowGet200Response.Now to non-nullable JSON property 'now'."); + + if (nowGet200Response.TodayOption.IsSet && nowGet200Response.Today == null) + throw new JsonException("Cannot write null property NowGet200Response.Today to non-nullable JSON property 'today'."); + if (nowGet200Response.NowOption.IsSet) writer.WriteString("now", nowGet200Response.NowOption.Value!.Value.ToString(NowFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs index 92932af4440b..3724280d3572 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -204,6 +204,12 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { + if (child.AgeOption.IsSet && child.Age == null) + throw new JsonException("Cannot write null property Child.Age to non-nullable JSON property 'age'."); + + if (child.BoosterSeatOption.IsSet && child.BoosterSeat == null) + throw new JsonException("Cannot write null property Child.BoosterSeat to non-nullable JSON property 'boosterSeat'."); + if (child.FirstNameOption.IsSet && child.FirstName == null) throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index bd5cbb6316bb..146ac2da958d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index 9bb8141992a2..4e5dcd6f057e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -173,6 +173,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index ab4dc8fbae43..891117de444d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 6646379a2ed9..a8bb9970d266 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Banana.cs index 6e96c0db4a48..1963adefce90 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index 6e639dde3a6c..d88783cbab2d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 8eb89f28aea2..dbf7d5878726 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs index 2144ad665422..c33db720faab 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 12f63bed52c3..f272f800a65b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index b709630ecb77..96c5f9bbb699 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs index 3369cd18ea98..3ed05af68273 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs @@ -351,6 +351,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index e62347530377..b16df5f518e0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 415953deb43f..d406287f4039 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index e77f1d49f342..09990a706a8c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs index 4b84f8966c49..f657f42be0ab 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index 1a88e07e0def..209be6be1047 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 140aba92a7e8..7881bc48f66e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Order.cs index b473008f6282..5db132a9cff4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -295,6 +295,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 6f783e7652b9..448c538f19d8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 64ca9cee6398..de88b51a5ecf 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -285,6 +285,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 45bb81479d52..d756563bf256 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,12 +1053,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs index 8490dbada03f..6870e58a4e5b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 6176113316b0..88ac872eba81 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index 88d268f8b94f..b6bcd6886413 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs index a5a5f43433ca..d0d4298cab55 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 9237807a5896..e367448c907f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs index 723e1590f152..dd4db4f456f1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 2dc6b12e05d8..c1abfbfd12c0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 416a3303da1c..6ee3d041ef55 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 41660a9d61d1..3ad9a7fbd48a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet) { var zeroBasedEnumRawValue = ZeroBasedEnumClassZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Banana.cs index bd5cbb6316bb..146ac2da958d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Orange.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Orange.cs index 938469b8ca38..ea6d4f8d915d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Orange.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Model/Orange.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Orange orange, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Orange orange, JsonSerializerOptions jsonSerializerOptions) { + if (orange.SweetOption.IsSet && orange.Sweet == null) + throw new JsonException("Cannot write null property Orange.Sweet to non-nullable JSON property 'sweet'."); + if (orange.SweetOption.IsSet) writer.WriteBoolean("sweet", orange.SweetOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index ab4dc8fbae43..891117de444d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 6646379a2ed9..a8bb9970d266 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Banana.cs index 6e96c0db4a48..1963adefce90 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index 6e639dde3a6c..d88783cbab2d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 8eb89f28aea2..dbf7d5878726 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs index 2144ad665422..c33db720faab 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 12f63bed52c3..f272f800a65b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index ea948a31b394..75fc3819ecf1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,6 +339,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 4f4100fc359e..bd1502d4326b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -875,6 +875,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index e62347530377..b16df5f518e0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 415953deb43f..d406287f4039 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index e77f1d49f342..09990a706a8c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs index 4b84f8966c49..f657f42be0ab 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 1a88e07e0def..209be6be1047 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 140aba92a7e8..7881bc48f66e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Order.cs index 76ffea5c5ab4..4d4a6167efc2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -384,6 +384,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 6f783e7652b9..448c538f19d8 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 4832f94a4a15..d8bb45eae944 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -374,6 +374,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 3a80bd868a9b..a5e6b6f451b2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,12 +2235,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs index 8490dbada03f..6870e58a4e5b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 6176113316b0..88ac872eba81 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 88d268f8b94f..b6bcd6886413 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs index a5a5f43433ca..d0d4298cab55 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 9237807a5896..e367448c907f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs index 723e1590f152..dd4db4f456f1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 2dc6b12e05d8..c1abfbfd12c0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 573b37ce6c98..c6144e93c73d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,6 +280,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index e8cf530a9235..4ce3561c85ec 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index c5c17f671b68..1fbff79470fe 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -199,6 +199,12 @@ public override void Write(Utf8JsonWriter writer, NowGet200Response nowGet200Res /// public void WriteProperties(Utf8JsonWriter writer, NowGet200Response nowGet200Response, JsonSerializerOptions jsonSerializerOptions) { + if (nowGet200Response.NowOption.IsSet && nowGet200Response.Now == null) + throw new JsonException("Cannot write null property NowGet200Response.Now to non-nullable JSON property 'now'."); + + if (nowGet200Response.TodayOption.IsSet && nowGet200Response.Today == null) + throw new JsonException("Cannot write null property NowGet200Response.Today to non-nullable JSON property 'today'."); + if (nowGet200Response.NowOption.IsSet) writer.WriteString("now", nowGet200Response.NowOption.Value.Value.ToString(NowFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs index 92932af4440b..3724280d3572 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -204,6 +204,12 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { + if (child.AgeOption.IsSet && child.Age == null) + throw new JsonException("Cannot write null property Child.Age to non-nullable JSON property 'age'."); + + if (child.BoosterSeatOption.IsSet && child.BoosterSeat == null) + throw new JsonException("Cannot write null property Child.BoosterSeat to non-nullable JSON property 'boosterSeat'."); + if (child.FirstNameOption.IsSet && child.FirstName == null) throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index bd5cbb6316bb..146ac2da958d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index 9bb8141992a2..4e5dcd6f057e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -173,6 +173,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index ab4dc8fbae43..891117de444d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 6646379a2ed9..a8bb9970d266 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Banana.cs index 6e96c0db4a48..1963adefce90 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index 6e639dde3a6c..d88783cbab2d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 8eb89f28aea2..dbf7d5878726 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs index 2144ad665422..c33db720faab 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 12f63bed52c3..f272f800a65b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index b709630ecb77..96c5f9bbb699 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs index 3369cd18ea98..3ed05af68273 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs @@ -351,6 +351,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index e62347530377..b16df5f518e0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 415953deb43f..d406287f4039 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index e77f1d49f342..09990a706a8c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs index 4b84f8966c49..f657f42be0ab 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index 1a88e07e0def..209be6be1047 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 140aba92a7e8..7881bc48f66e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Order.cs index b473008f6282..5db132a9cff4 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -295,6 +295,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 6f783e7652b9..448c538f19d8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 64ca9cee6398..de88b51a5ecf 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -285,6 +285,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 45bb81479d52..d756563bf256 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,12 +1053,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs index 8490dbada03f..6870e58a4e5b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 6176113316b0..88ac872eba81 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index 88d268f8b94f..b6bcd6886413 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs index a5a5f43433ca..d0d4298cab55 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 9237807a5896..e367448c907f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs index 723e1590f152..dd4db4f456f1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 2dc6b12e05d8..c1abfbfd12c0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 416a3303da1c..6ee3d041ef55 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 41660a9d61d1..3ad9a7fbd48a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet) { var zeroBasedEnumRawValue = ZeroBasedEnumClassZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Banana.cs index bd5cbb6316bb..146ac2da958d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Orange.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Orange.cs index 938469b8ca38..ea6d4f8d915d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Orange.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Model/Orange.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Orange orange, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Orange orange, JsonSerializerOptions jsonSerializerOptions) { + if (orange.SweetOption.IsSet && orange.Sweet == null) + throw new JsonException("Cannot write null property Orange.Sweet to non-nullable JSON property 'sweet'."); + if (orange.SweetOption.IsSet) writer.WriteBoolean("sweet", orange.SweetOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index ab4dc8fbae43..891117de444d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 6646379a2ed9..a8bb9970d266 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Banana.cs index 6e96c0db4a48..1963adefce90 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index 6e639dde3a6c..d88783cbab2d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 8eb89f28aea2..dbf7d5878726 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs index 2144ad665422..c33db720faab 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 12f63bed52c3..f272f800a65b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index ea948a31b394..75fc3819ecf1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,6 +339,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 4f4100fc359e..bd1502d4326b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -875,6 +875,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index e62347530377..b16df5f518e0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 415953deb43f..d406287f4039 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index e77f1d49f342..09990a706a8c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs index 4b84f8966c49..f657f42be0ab 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 1a88e07e0def..209be6be1047 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 140aba92a7e8..7881bc48f66e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Order.cs index 76ffea5c5ab4..4d4a6167efc2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -384,6 +384,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 6f783e7652b9..448c538f19d8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 4832f94a4a15..d8bb45eae944 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -374,6 +374,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 3a80bd868a9b..a5e6b6f451b2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,12 +2235,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs index 8490dbada03f..6870e58a4e5b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 6176113316b0..88ac872eba81 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 88d268f8b94f..b6bcd6886413 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs index a5a5f43433ca..d0d4298cab55 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 9237807a5896..e367448c907f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs index 723e1590f152..dd4db4f456f1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 2dc6b12e05d8..c1abfbfd12c0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 573b37ce6c98..c6144e93c73d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,6 +280,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index e8cf530a9235..4ce3561c85ec 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index c5c17f671b68..1fbff79470fe 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -199,6 +199,12 @@ public override void Write(Utf8JsonWriter writer, NowGet200Response nowGet200Res /// public void WriteProperties(Utf8JsonWriter writer, NowGet200Response nowGet200Response, JsonSerializerOptions jsonSerializerOptions) { + if (nowGet200Response.NowOption.IsSet && nowGet200Response.Now == null) + throw new JsonException("Cannot write null property NowGet200Response.Now to non-nullable JSON property 'now'."); + + if (nowGet200Response.TodayOption.IsSet && nowGet200Response.Today == null) + throw new JsonException("Cannot write null property NowGet200Response.Today to non-nullable JSON property 'today'."); + if (nowGet200Response.NowOption.IsSet) writer.WriteString("now", nowGet200Response.NowOption.Value.Value.ToString(NowFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs index 4aa344a128f6..f71f244652dc 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -206,6 +206,12 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { + if (child.AgeOption.IsSet && child.Age == null) + throw new JsonException("Cannot write null property Child.Age to non-nullable JSON property 'age'."); + + if (child.BoosterSeatOption.IsSet && child.BoosterSeat == null) + throw new JsonException("Cannot write null property Child.BoosterSeat to non-nullable JSON property 'boosterSeat'."); + if (child.FirstNameOption.IsSet && child.FirstName == null) throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index ddd75420f237..65dc4a02463e 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index b31f8fe51330..7b0cc8bc8756 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -175,6 +175,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 894db21c2542..332e1e100ce2 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 1096570780ec..cc81766fcebe 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Banana.cs index 40d370fd1cdb..d887a45c931e 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index 0673de456831..db3b3f2aabd1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 0cd7b560fb24..f3f27956ed3b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs index df8dc6dc03e2..d78edc3ee72c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 2b1f5670dec1..72a7565ec3c6 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index 943f8ad3d406..ee70392a1686 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs index cab43b30299d..780950460e89 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs @@ -351,6 +351,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index a00d62ec2e06..b489e77a1e15 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 228d6c3cab98..1d5a4defe637 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index d75e2197a1a7..bb2913f5df66 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs index fc65064ac4e8..19757fa1c327 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index 21b40632deb7..428f234deaeb 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 56dfe1215b0d..d8bd9f36ea39 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Order.cs index 79cfaaf0e5bf..66edef8216f7 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -295,6 +295,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 9fd968c817d6..93be59d99690 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 65396833098d..f60a0987b590 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -285,6 +285,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 16e4165975b4..eeda5ef0fcc7 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,12 +1053,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs index d655ddfb2ce0..c4b5b9636bb3 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index e3676b9555c5..9b73fae206ff 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index edcba4dae388..9b3bfdab8bcf 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs index 879c52edb8a1..9ac1082f742a 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 0ca59c6ad79b..5abf98b1e65b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs index cf3e65aa1327..90deb77dbaaa 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 9f99606b7fa8..1cdb5bad9dd1 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 61583d889dad..67b6d90eb1d7 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 9add0a06d4cc..ad7eadb1b479 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet) { var zeroBasedEnumRawValue = ZeroBasedEnumClassZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs index 866888eb836c..70585c8acf5b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs index 5091186fdbdc..a98f5bd8787f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -188,6 +188,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs index fab250f7b537..0a7d794e23fc 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs index 42e9d1890af1..1973db4c4bed 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs @@ -188,6 +188,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs index 0759faaf06af..0f47bd35e784 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -181,6 +181,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs index 4101d46d205f..d411efbb83bd 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -195,6 +195,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs index c04c4f439bdf..f39aa601716f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -182,6 +182,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs index 8fa2f6d57739..05f5e7db1d24 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -341,6 +341,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs index 647002803b89..62c8f51ce807 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs @@ -877,6 +877,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs index 0291786cf4e5..1badd1c0d948 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -956,12 +956,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -974,6 +1010,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 175027917ad1..1cef2917ba78 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -257,9 +257,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs index f79e2eac8d8f..ff4080153aea 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs index 5d7ca65e2a70..8fd568be1a6b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -285,6 +285,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs index fa2f63c11abf..a463ed4572d3 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 1007be70c886..03727598207c 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -254,6 +254,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs index ac6f4585d259..ee4d0c85d40a 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs @@ -386,6 +386,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs index bdd0db7f40e9..686aa2d77797 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -222,6 +222,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs index b9556e0402d0..5c16160c5db9 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -376,6 +376,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs index f8f5a836850e..1912f3c24ebf 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2237,12 +2237,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs index aeaa9fe0d2c2..fd9446247331 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -234,6 +234,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 56e323eb1cc8..ac6dd43ef0b2 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs index 4d3a32498644..81c58c98aa68 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs index ed520154f099..a16ea726bfff 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -199,6 +199,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs index 19455a837c65..d168aff8b9c2 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs @@ -224,6 +224,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs index 7c8a73e2ca82..c6a4d2cddb86 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -431,6 +431,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -443,6 +446,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs index a855f0431854..74e3afd8dbf8 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -218,6 +218,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs index a9f35d0bd260..f6faea2fd5ed 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs @@ -282,6 +282,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 5e17279cd925..796310e1783f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -249,6 +249,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Banana.cs index ddd75420f237..65dc4a02463e 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Orange.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Orange.cs index 02e5aab13a27..793f5553239f 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Orange.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Model/Orange.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Orange orange, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Orange orange, JsonSerializerOptions jsonSerializerOptions) { + if (orange.SweetOption.IsSet && orange.Sweet == null) + throw new JsonException("Cannot write null property Orange.Sweet to non-nullable JSON property 'sweet'."); + if (orange.SweetOption.IsSet) writer.WriteBoolean("sweet", orange.SweetOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 894db21c2542..332e1e100ce2 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 1096570780ec..cc81766fcebe 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs index 40d370fd1cdb..d887a45c931e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index 0673de456831..db3b3f2aabd1 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 0cd7b560fb24..f3f27956ed3b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs index df8dc6dc03e2..d78edc3ee72c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 2b1f5670dec1..72a7565ec3c6 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index bc284aa6ef5d..231e6fbbf6bc 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,6 +339,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 62d913a7c0d7..0aaa3e6fe0aa 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -875,6 +875,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index a00d62ec2e06..b489e77a1e15 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 228d6c3cab98..1d5a4defe637 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index d75e2197a1a7..bb2913f5df66 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs index fc65064ac4e8..19757fa1c327 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 21b40632deb7..428f234deaeb 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 56dfe1215b0d..d8bd9f36ea39 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs index 43827461cc02..d3f99122b153 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -384,6 +384,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 9fd968c817d6..93be59d99690 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs index a95f55c8bee3..6d3d8121e68c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -374,6 +374,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 697eb747f6ec..50d69fccab91 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,12 +2235,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs index d655ddfb2ce0..c4b5b9636bb3 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index e3676b9555c5..9b73fae206ff 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index edcba4dae388..9b3bfdab8bcf 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 879c52edb8a1..9ac1082f742a 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 0ca59c6ad79b..5abf98b1e65b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs index cf3e65aa1327..90deb77dbaaa 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 9f99606b7fa8..1cdb5bad9dd1 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 476487740ff7..8bd6f70f0a95 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,6 +280,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 18dfbaafaf8c..0f0d25e333db 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs index ff9b64de4fe5..6895b23c9654 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -223,6 +223,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs index 505491f73869..95c14d25d542 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs index c35241ce3891..fd95bd629bbe 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs index 5639dd362d9b..afdff1b19be1 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs index 4231f2c01135..c44fc9083169 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -182,6 +182,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs index 33ec2ed9905d..9795a7beec1b 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -196,6 +196,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 38bca8c661f8..60ef9165d975 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -183,6 +183,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs index d07f1518f6ce..5c6eccf09721 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -342,6 +342,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs index 534039c94588..57e8cd61d373 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs @@ -878,6 +878,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs index 50a33f2580bf..bc64a259b1eb 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -957,12 +957,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -975,6 +1011,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index e75d3ba0ffc5..2a2d05afb5bf 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -258,9 +258,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs index 44a323173884..4538cb6884df 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs index fc70dd80cb4d..37f41d119044 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -286,6 +286,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs index 46933a2fbf95..b051d11b1761 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 62fccbbcc8a0..e041d875bc51 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -255,6 +255,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs index c4a7ebd764c5..5a9d1362547d 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs @@ -387,6 +387,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs index 9791bf2027d3..4a94f026f474 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -223,6 +223,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs index b91b50503d72..4e7c71f8a59d 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -377,6 +377,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs index 3ba198d8e0bd..599aa94d5e5e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2238,12 +2238,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs index ef308616828c..36c27ec413ed 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -235,6 +235,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 1d07de3a4b45..bbaefb23e8b7 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs index 345cd905709a..edf8a9edcacf 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs index 7f53fa7ebbbd..a5f86d17a002 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -200,6 +200,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs index 2ef0d0971d77..eee7fb7736e2 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs @@ -225,6 +225,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs index ea4bce9e000e..2589af030b24 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -432,6 +432,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -444,6 +447,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs index f66ffed7581c..a55ad54be20d 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -219,6 +219,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs index d5e1f9506697..143976f6b272 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs @@ -283,6 +283,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 98e4d7afdbfd..733adac3c5c4 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -250,6 +250,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index 7027a58c996a..f8d7a66197ae 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -201,6 +201,12 @@ public override void Write(Utf8JsonWriter writer, NowGet200Response nowGet200Res /// public void WriteProperties(Utf8JsonWriter writer, NowGet200Response nowGet200Response, JsonSerializerOptions jsonSerializerOptions) { + if (nowGet200Response.NowOption.IsSet && nowGet200Response.Now == null) + throw new JsonException("Cannot write null property NowGet200Response.Now to non-nullable JSON property 'now'."); + + if (nowGet200Response.TodayOption.IsSet && nowGet200Response.Today == null) + throw new JsonException("Cannot write null property NowGet200Response.Today to non-nullable JSON property 'today'."); + if (nowGet200Response.NowOption.IsSet) writer.WriteString("now", nowGet200Response.NowOption.Value!.Value.ToString(NowFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs index 4aa344a128f6..f71f244652dc 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -206,6 +206,12 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { + if (child.AgeOption.IsSet && child.Age == null) + throw new JsonException("Cannot write null property Child.Age to non-nullable JSON property 'age'."); + + if (child.BoosterSeatOption.IsSet && child.BoosterSeat == null) + throw new JsonException("Cannot write null property Child.BoosterSeat to non-nullable JSON property 'boosterSeat'."); + if (child.FirstNameOption.IsSet && child.FirstName == null) throw new JsonException("Cannot write null property Child.FirstName to non-nullable JSON property 'firstName'."); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs index ddd75420f237..65dc4a02463e 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs index b31f8fe51330..7b0cc8bc8756 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -175,6 +175,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs index 894db21c2542..332e1e100ce2 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs index 1096570780ec..cc81766fcebe 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs index 40d370fd1cdb..d887a45c931e 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs index 0673de456831..db3b3f2aabd1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs index 0cd7b560fb24..f3f27956ed3b 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs index df8dc6dc03e2..d78edc3ee72c 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 2b1f5670dec1..72a7565ec3c6 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs index 943f8ad3d406..ee70392a1686 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs index cab43b30299d..780950460e89 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs @@ -351,6 +351,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs index a00d62ec2e06..b489e77a1e15 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 228d6c3cab98..1d5a4defe637 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs index d75e2197a1a7..bb2913f5df66 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs index fc65064ac4e8..19757fa1c327 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs index 21b40632deb7..428f234deaeb 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 56dfe1215b0d..d8bd9f36ea39 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs index 79cfaaf0e5bf..66edef8216f7 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -295,6 +295,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs index 9fd968c817d6..93be59d99690 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs index 65396833098d..f60a0987b590 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -285,6 +285,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs index 16e4165975b4..eeda5ef0fcc7 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1053,12 +1053,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs index d655ddfb2ce0..c4b5b9636bb3 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs index e3676b9555c5..9b73fae206ff 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs index edcba4dae388..9b3bfdab8bcf 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs index 879c52edb8a1..9ac1082f742a 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs index 0ca59c6ad79b..5abf98b1e65b 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs index cf3e65aa1327..90deb77dbaaa 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs index 9f99606b7fa8..1cdb5bad9dd1 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs index 61583d889dad..67b6d90eb1d7 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); if (zebra.TypeOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 9add0a06d4cc..ad7eadb1b479 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet) { var zeroBasedEnumRawValue = ZeroBasedEnumClassZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs index 866888eb836c..70585c8acf5b 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs index 5091186fdbdc..a98f5bd8787f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -188,6 +188,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs index fab250f7b537..0a7d794e23fc 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs index 42e9d1890af1..1973db4c4bed 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs @@ -188,6 +188,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs index 0759faaf06af..0f47bd35e784 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -181,6 +181,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs index 4101d46d205f..d411efbb83bd 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -195,6 +195,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs index c04c4f439bdf..f39aa601716f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -182,6 +182,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs index 8fa2f6d57739..05f5e7db1d24 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -341,6 +341,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs index 647002803b89..62c8f51ce807 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs @@ -877,6 +877,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs index 0291786cf4e5..1badd1c0d948 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -956,12 +956,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -974,6 +1010,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 175027917ad1..1cef2917ba78 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -257,9 +257,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs index f79e2eac8d8f..ff4080153aea 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs index 5d7ca65e2a70..8fd568be1a6b 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -285,6 +285,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs index fa2f63c11abf..a463ed4572d3 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 1007be70c886..03727598207c 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -254,6 +254,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs index ac6f4585d259..ee4d0c85d40a 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs @@ -386,6 +386,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs index bdd0db7f40e9..686aa2d77797 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -222,6 +222,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs index b9556e0402d0..5c16160c5db9 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -376,6 +376,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs index f8f5a836850e..1912f3c24ebf 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2237,12 +2237,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs index aeaa9fe0d2c2..fd9446247331 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -234,6 +234,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 56e323eb1cc8..ac6dd43ef0b2 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs index 4d3a32498644..81c58c98aa68 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -202,6 +202,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs index ed520154f099..a16ea726bfff 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -199,6 +199,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs index 19455a837c65..d168aff8b9c2 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestResult.cs @@ -224,6 +224,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs index 7c8a73e2ca82..c6a4d2cddb86 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -431,6 +431,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -443,6 +446,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs index a855f0431854..74e3afd8dbf8 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -218,6 +218,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs index a9f35d0bd260..f6faea2fd5ed 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs @@ -282,6 +282,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 5e17279cd925..796310e1783f 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -249,6 +249,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs index ddd75420f237..65dc4a02463e 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.CountOption.IsSet && banana.Count == null) + throw new JsonException("Cannot write null property Banana.Count to non-nullable JSON property 'count'."); + if (banana.CountOption.IsSet) writer.WriteNumber("count", banana.CountOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Orange.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Orange.cs index 02e5aab13a27..793f5553239f 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Orange.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Orange.cs @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, Orange orange, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Orange orange, JsonSerializerOptions jsonSerializerOptions) { + if (orange.SweetOption.IsSet && orange.Sweet == null) + throw new JsonException("Cannot write null property Orange.Sweet to non-nullable JSON property 'sweet'."); + if (orange.SweetOption.IsSet) writer.WriteBoolean("sweet", orange.SweetOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index 894db21c2542..332e1e100ce2 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 1096570780ec..cc81766fcebe 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs index 40d370fd1cdb..d887a45c931e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index 0673de456831..db3b3f2aabd1 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 0cd7b560fb24..f3f27956ed3b 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs index df8dc6dc03e2..d78edc3ee72c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 2b1f5670dec1..72a7565ec3c6 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index bc284aa6ef5d..231e6fbbf6bc 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,6 +339,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 62d913a7c0d7..0aaa3e6fe0aa 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -875,6 +875,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index a00d62ec2e06..b489e77a1e15 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 228d6c3cab98..1d5a4defe637 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index d75e2197a1a7..bb2913f5df66 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs index fc65064ac4e8..19757fa1c327 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 21b40632deb7..428f234deaeb 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 56dfe1215b0d..d8bd9f36ea39 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs index 43827461cc02..d3f99122b153 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -384,6 +384,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 9fd968c817d6..93be59d99690 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs index a95f55c8bee3..6d3d8121e68c 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -374,6 +374,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 697eb747f6ec..50d69fccab91 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,12 +2235,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs index d655ddfb2ce0..c4b5b9636bb3 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index e3676b9555c5..9b73fae206ff 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index edcba4dae388..9b3bfdab8bcf 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs index 879c52edb8a1..9ac1082f742a 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 0ca59c6ad79b..5abf98b1e65b 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs index cf3e65aa1327..90deb77dbaaa 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 9f99606b7fa8..1cdb5bad9dd1 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 476487740ff7..8bd6f70f0a95 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,6 +280,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 18dfbaafaf8c..0f0d25e333db 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs index ff9b64de4fe5..6895b23c9654 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -223,6 +223,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs index 505491f73869..95c14d25d542 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs index c35241ce3891..fd95bd629bbe 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs index 5639dd362d9b..afdff1b19be1 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs @@ -189,6 +189,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs index 4231f2c01135..c44fc9083169 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -182,6 +182,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs index 33ec2ed9905d..9795a7beec1b 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -196,6 +196,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 38bca8c661f8..60ef9165d975 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -183,6 +183,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs index d07f1518f6ce..5c6eccf09721 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -342,6 +342,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs index 534039c94588..57e8cd61d373 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs @@ -878,6 +878,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs index 50a33f2580bf..bc64a259b1eb 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -957,12 +957,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -975,6 +1011,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index e75d3ba0ffc5..2a2d05afb5bf 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -258,9 +258,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs index 44a323173884..4538cb6884df 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs index fc70dd80cb4d..37f41d119044 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -286,6 +286,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs index 46933a2fbf95..b051d11b1761 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 62fccbbcc8a0..e041d875bc51 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -255,6 +255,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs index c4a7ebd764c5..5a9d1362547d 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs @@ -387,6 +387,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs index 9791bf2027d3..4a94f026f474 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -223,6 +223,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs index b91b50503d72..4e7c71f8a59d 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -377,6 +377,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs index 3ba198d8e0bd..599aa94d5e5e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2238,12 +2238,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs index ef308616828c..36c27ec413ed 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -235,6 +235,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 1d07de3a4b45..bbaefb23e8b7 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs index 345cd905709a..edf8a9edcacf 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -203,6 +203,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs index 7f53fa7ebbbd..a5f86d17a002 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -200,6 +200,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs index 2ef0d0971d77..eee7fb7736e2 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestResult.cs @@ -225,6 +225,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs index ea4bce9e000e..2589af030b24 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -432,6 +432,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -444,6 +447,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs index f66ffed7581c..a55ad54be20d 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -219,6 +219,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs index d5e1f9506697..143976f6b272 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs @@ -283,6 +283,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 98e4d7afdbfd..733adac3c5c4 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -250,6 +250,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); } diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs index 7027a58c996a..f8d7a66197ae 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -201,6 +201,12 @@ public override void Write(Utf8JsonWriter writer, NowGet200Response nowGet200Res /// public void WriteProperties(Utf8JsonWriter writer, NowGet200Response nowGet200Response, JsonSerializerOptions jsonSerializerOptions) { + if (nowGet200Response.NowOption.IsSet && nowGet200Response.Now == null) + throw new JsonException("Cannot write null property NowGet200Response.Now to non-nullable JSON property 'now'."); + + if (nowGet200Response.TodayOption.IsSet && nowGet200Response.Today == null) + throw new JsonException("Cannot write null property NowGet200Response.Today to non-nullable JSON property 'today'."); + if (nowGet200Response.NowOption.IsSet) writer.WriteString("now", nowGet200Response.NowOption.Value!.Value.ToString(NowFormat)); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs index ab4dc8fbae43..891117de444d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -220,6 +220,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.CodeOption.IsSet && apiResponse.Code == null) + throw new JsonException("Cannot write null property ApiResponse.Code to non-nullable JSON property 'code'."); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) throw new JsonException("Cannot write null property ApiResponse.Message to non-nullable JSON property 'message'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs index 6646379a2ed9..a8bb9970d266 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.MealyOption.IsSet && appleReq.Mealy == null) + throw new JsonException("Cannot write null property AppleReq.Mealy to non-nullable JSON property 'mealy'."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Banana.cs index 6e96c0db4a48..1963adefce90 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { + if (banana.LengthCmOption.IsSet && banana.LengthCm == null) + throw new JsonException("Cannot write null property Banana.LengthCm to non-nullable JSON property 'lengthCm'."); + if (banana.LengthCmOption.IsSet) writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs index 6e639dde3a6c..d88783cbab2d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { + if (bananaReq.SweetOption.IsSet && bananaReq.Sweet == null) + throw new JsonException("Cannot write null property BananaReq.Sweet to non-nullable JSON property 'sweet'."); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs index 8eb89f28aea2..dbf7d5878726 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -179,6 +179,9 @@ public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOption if (cat.ColorOption.IsSet && cat.Color == null) throw new JsonException("Cannot write null property Cat.Color to non-nullable JSON property 'color'."); + if (cat.DeclawedOption.IsSet && cat.Declawed == null) + throw new JsonException("Cannot write null property Cat.Declawed to non-nullable JSON property 'declawed'."); + writer.WriteString("className", cat.ClassName); if (cat.ColorOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs index 2144ad665422..c33db720faab 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -193,6 +193,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.IdOption.IsSet && category.Id == null) + throw new JsonException("Cannot write null property Category.Id to non-nullable JSON property 'id'."); + if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 12f63bed52c3..f272f800a65b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet && dateOnlyClass.DateOnlyProperty == null) + throw new JsonException("Cannot write null property DateOnlyClass.DateOnlyProperty to non-nullable JSON property 'dateOnlyProperty'."); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs index ea948a31b394..75fc3819ecf1 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -339,6 +339,9 @@ public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSe if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new JsonException("Cannot write null property EnumArrays.ArrayEnum to non-nullable JSON property 'array_enum'."); + if (enumArrays.JustSymbolOption.IsSet && enumArrays.JustSymbol == null) + throw new JsonException("Cannot write null property EnumArrays.JustSymbol to non-nullable JSON property 'just_symbol'."); + if (enumArrays.ArrayEnumOption.IsSet) { writer.WritePropertyName("array_enum"); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs index 4f4100fc359e..bd1502d4326b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -875,6 +875,27 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + if (enumTest.EnumIntegerOption.IsSet && enumTest.EnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.EnumInteger to non-nullable JSON property 'enum_integer'."); + + if (enumTest.EnumIntegerOnlyOption.IsSet && enumTest.EnumIntegerOnly == null) + throw new JsonException("Cannot write null property EnumTest.EnumIntegerOnly to non-nullable JSON property 'enum_integer_only'."); + + if (enumTest.EnumNumberOption.IsSet && enumTest.EnumNumber == null) + throw new JsonException("Cannot write null property EnumTest.EnumNumber to non-nullable JSON property 'enum_number'."); + + if (enumTest.EnumStringOption.IsSet && enumTest.EnumString == null) + throw new JsonException("Cannot write null property EnumTest.EnumString to non-nullable JSON property 'enum_string'."); + + if (enumTest.OuterEnumDefaultValueOption.IsSet && enumTest.OuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumDefaultValue to non-nullable JSON property 'outerEnumDefaultValue'."); + + if (enumTest.OuterEnumIntegerOption.IsSet && enumTest.OuterEnumInteger == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumInteger to non-nullable JSON property 'outerEnumInteger'."); + + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet && enumTest.OuterEnumIntegerDefaultValue == null) + throw new JsonException("Cannot write null property EnumTest.OuterEnumIntegerDefaultValue to non-nullable JSON property 'outerEnumIntegerDefaultValue'."); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); writer.WriteString("enum_string_required", enumStringRequiredRawValue); if (enumTest.EnumIntegerOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs index e62347530377..b16df5f518e0 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -954,12 +954,48 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) throw new JsonException("Cannot write null property FormatTest.Binary to non-nullable JSON property 'binary'."); + if (formatTest.DateTimeOption.IsSet && formatTest.DateTime == null) + throw new JsonException("Cannot write null property FormatTest.DateTime to non-nullable JSON property 'dateTime'."); + + if (formatTest.DecimalOption.IsSet && formatTest.Decimal == null) + throw new JsonException("Cannot write null property FormatTest.Decimal to non-nullable JSON property 'decimal'."); + + if (formatTest.DoubleOption.IsSet && formatTest.Double == null) + throw new JsonException("Cannot write null property FormatTest.Double to non-nullable JSON property 'double'."); + if (formatTest.DuplicatePropertyName2Option.IsSet && formatTest.DuplicatePropertyName2 == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName2 to non-nullable JSON property 'duplicate_property_name'."); if (formatTest.DuplicatePropertyNameOption.IsSet && formatTest.DuplicatePropertyName == null) throw new JsonException("Cannot write null property FormatTest.DuplicatePropertyName to non-nullable JSON property '@duplicate_property_name'."); + if (formatTest.FloatOption.IsSet && formatTest.Float == null) + throw new JsonException("Cannot write null property FormatTest.Float to non-nullable JSON property 'float'."); + + if (formatTest.Int32Option.IsSet && formatTest.Int32 == null) + throw new JsonException("Cannot write null property FormatTest.Int32 to non-nullable JSON property 'int32'."); + + if (formatTest.Int32RangeOption.IsSet && formatTest.Int32Range == null) + throw new JsonException("Cannot write null property FormatTest.Int32Range to non-nullable JSON property 'int32Range'."); + + if (formatTest.Int64Option.IsSet && formatTest.Int64 == null) + throw new JsonException("Cannot write null property FormatTest.Int64 to non-nullable JSON property 'int64'."); + + if (formatTest.Int64NegativeOption.IsSet && formatTest.Int64Negative == null) + throw new JsonException("Cannot write null property FormatTest.Int64Negative to non-nullable JSON property 'int64Negative'."); + + if (formatTest.Int64NegativeExclusiveOption.IsSet && formatTest.Int64NegativeExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64NegativeExclusive to non-nullable JSON property 'int64NegativeExclusive'."); + + if (formatTest.Int64PositiveOption.IsSet && formatTest.Int64Positive == null) + throw new JsonException("Cannot write null property FormatTest.Int64Positive to non-nullable JSON property 'int64Positive'."); + + if (formatTest.Int64PositiveExclusiveOption.IsSet && formatTest.Int64PositiveExclusive == null) + throw new JsonException("Cannot write null property FormatTest.Int64PositiveExclusive to non-nullable JSON property 'int64PositiveExclusive'."); + + if (formatTest.IntegerOption.IsSet && formatTest.Integer == null) + throw new JsonException("Cannot write null property FormatTest.Integer to non-nullable JSON property 'integer'."); + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) throw new JsonException("Cannot write null property FormatTest.PatternWithBackslash to non-nullable JSON property 'pattern_with_backslash'."); @@ -972,6 +1008,18 @@ public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSe if (formatTest.StringOption.IsSet && formatTest.String == null) throw new JsonException("Cannot write null property FormatTest.String to non-nullable JSON property 'string'."); + if (formatTest.StringFormattedAsDecimalOption.IsSet && formatTest.StringFormattedAsDecimal == null) + throw new JsonException("Cannot write null property FormatTest.StringFormattedAsDecimal to non-nullable JSON property 'string_formatted_as_decimal'."); + + if (formatTest.UnsignedIntegerOption.IsSet && formatTest.UnsignedInteger == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedInteger to non-nullable JSON property 'unsigned_integer'."); + + if (formatTest.UnsignedLongOption.IsSet && formatTest.UnsignedLong == null) + throw new JsonException("Cannot write null property FormatTest.UnsignedLong to non-nullable JSON property 'unsigned_long'."); + + if (formatTest.UuidOption.IsSet && formatTest.Uuid == null) + throw new JsonException("Cannot write null property FormatTest.Uuid to non-nullable JSON property 'uuid'."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 415953deb43f..d406287f4039 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,9 +255,18 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.DateTime == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.DateTime to non-nullable JSON property 'dateTime'."); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Map to non-nullable JSON property 'map'."); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Uuid == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.Uuid to non-nullable JSON property 'uuid'."); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern == null) + throw new JsonException("Cannot write null property MixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern to non-nullable JSON property 'uuid_with_pattern'."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs index e77f1d49f342..09990a706a8c 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Resp if (model200Response.ClassOption.IsSet && model200Response.Class == null) throw new JsonException("Cannot write null property Model200Response.Class to non-nullable JSON property 'class'."); + if (model200Response.NameOption.IsSet && model200Response.Name == null) + throw new JsonException("Cannot write null property Model200Response.Name to non-nullable JSON property 'name'."); + if (model200Response.ClassOption.IsSet) writer.WriteString("class", model200Response.Class); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs index 4b84f8966c49..f657f42be0ab 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -283,6 +283,12 @@ public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOpti if (name.PropertyOption.IsSet && name.Property == null) throw new JsonException("Cannot write null property Name.Property to non-nullable JSON property 'property'."); + if (name.SnakeCaseOption.IsSet && name.SnakeCase == null) + throw new JsonException("Cannot write null property Name.SnakeCase to non-nullable JSON property 'snake_case'."); + + if (name.Var123NumberOption.IsSet && name.Var123Number == null) + throw new JsonException("Cannot write null property Name.Var123Number to non-nullable JSON property '123Number'."); + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs index 1a88e07e0def..209be6be1047 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (numberOnly.JustNumberOption.IsSet && numberOnly.JustNumber == null) + throw new JsonException("Cannot write null property NumberOnly.JustNumber to non-nullable JSON property 'JustNumber'."); + if (numberOnly.JustNumberOption.IsSet) writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 140aba92a7e8..7881bc48f66e 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -252,6 +252,9 @@ public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields ob if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.DeprecatedRef to non-nullable JSON property 'deprecatedRef'."); + if (objectWithDeprecatedFields.IdOption.IsSet && objectWithDeprecatedFields.Id == null) + throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Id to non-nullable JSON property 'id'."); + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new JsonException("Cannot write null property ObjectWithDeprecatedFields.Uuid to non-nullable JSON property 'uuid'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Order.cs index 76ffea5c5ab4..4d4a6167efc2 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -384,6 +384,24 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet && order.Complete == null) + throw new JsonException("Cannot write null property Order.Complete to non-nullable JSON property 'complete'."); + + if (order.IdOption.IsSet && order.Id == null) + throw new JsonException("Cannot write null property Order.Id to non-nullable JSON property 'id'."); + + if (order.PetIdOption.IsSet && order.PetId == null) + throw new JsonException("Cannot write null property Order.PetId to non-nullable JSON property 'petId'."); + + if (order.QuantityOption.IsSet && order.Quantity == null) + throw new JsonException("Cannot write null property Order.Quantity to non-nullable JSON property 'quantity'."); + + if (order.ShipDateOption.IsSet && order.ShipDate == null) + throw new JsonException("Cannot write null property Order.ShipDate to non-nullable JSON property 'shipDate'."); + + if (order.StatusOption.IsSet && order.Status == null) + throw new JsonException("Cannot write null property Order.Status to non-nullable JSON property 'status'."); + if (order.CompleteOption.IsSet) writer.WriteBoolean("complete", order.CompleteOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs index 6f783e7652b9..448c538f19d8 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyBooleanOption.IsSet && outerComposite.MyBoolean == null) + throw new JsonException("Cannot write null property OuterComposite.MyBoolean to non-nullable JSON property 'my_boolean'."); + + if (outerComposite.MyNumberOption.IsSet && outerComposite.MyNumber == null) + throw new JsonException("Cannot write null property OuterComposite.MyNumber to non-nullable JSON property 'my_number'."); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) throw new JsonException("Cannot write null property OuterComposite.MyString to non-nullable JSON property 'my_string'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs index 4832f94a4a15..d8bb45eae944 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -374,6 +374,12 @@ public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOption if (pet.CategoryOption.IsSet && pet.Category == null) throw new JsonException("Cannot write null property Pet.Category to non-nullable JSON property 'category'."); + if (pet.IdOption.IsSet && pet.Id == null) + throw new JsonException("Cannot write null property Pet.Id to non-nullable JSON property 'id'."); + + if (pet.StatusOption.IsSet && pet.Status == null) + throw new JsonException("Cannot write null property Pet.Status to non-nullable JSON property 'status'."); + if (pet.TagsOption.IsSet && pet.Tags == null) throw new JsonException("Cannot write null property Pet.Tags to non-nullable JSON property 'tags'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs index 3a80bd868a9b..a5e6b6f451b2 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2235,12 +2235,39 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet && requiredClass.NotRequiredNotnullableDateProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableDateProp to non-nullable JSON property 'not_required_notnullable_date_prop'."); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet && requiredClass.NotRequiredNotnullableintegerProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotRequiredNotnullableintegerProp to non-nullable JSON property 'not_required_notnullableinteger_prop'."); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableArrayOfString to non-nullable JSON property 'notrequired_notnullable_array_of_string'."); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet && requiredClass.NotrequiredNotnullableBooleanProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableBooleanProp to non-nullable JSON property 'notrequired_notnullable_boolean_prop'."); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet && requiredClass.NotrequiredNotnullableDatetimeProp == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableDatetimeProp to non-nullable JSON property 'notrequired_notnullable_datetime_prop'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet && requiredClass.NotrequiredNotnullableEnumInteger == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumInteger to non-nullable JSON property 'notrequired_notnullable_enum_integer'."); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet && requiredClass.NotrequiredNotnullableEnumIntegerOnly == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumIntegerOnly to non-nullable JSON property 'notrequired_notnullable_enum_integer_only'."); + + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet && requiredClass.NotrequiredNotnullableEnumString == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableEnumString to non-nullable JSON property 'notrequired_notnullable_enum_string'."); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet && requiredClass.NotrequiredNotnullableOuterEnumDefaultValue == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableOuterEnumDefaultValue to non-nullable JSON property 'notrequired_notnullable_outerEnumDefaultValue'."); + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableStringProp to non-nullable JSON property 'notrequired_notnullable_string_prop'."); + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet && requiredClass.NotrequiredNotnullableUuid == null) + throw new JsonException("Cannot write null property RequiredClass.NotrequiredNotnullableUuid to non-nullable JSON property 'notrequired_notnullable_uuid'."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs index 8490dbada03f..6870e58a4e5b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -232,6 +232,9 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { + if (varReturn.VarReturnOption.IsSet && varReturn.VarReturn == null) + throw new JsonException("Cannot write null property Return.VarReturn to non-nullable JSON property 'return'."); + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) throw new JsonException("Cannot write null property Return.Unsafe to non-nullable JSON property 'unsafe'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 6176113316b0..88ac872eba81 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReports if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new JsonException("Cannot write null property RolesReportsHash.Role to non-nullable JSON property 'role'."); + if (rolesReportsHash.RoleUuidOption.IsSet && rolesReportsHash.RoleUuid == null) + throw new JsonException("Cannot write null property RolesReportsHash.RoleUuid to non-nullable JSON property 'role_uuid'."); + if (rolesReportsHash.RoleOption.IsSet) { writer.WritePropertyName("role"); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs index 88d268f8b94f..b6bcd6886413 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -200,6 +200,9 @@ public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModel if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) throw new JsonException("Cannot write null property SpecialModelName.VarSpecialModelName to non-nullable JSON property '_special_model.name_'."); + if (specialModelName.SpecialPropertyNameOption.IsSet && specialModelName.SpecialPropertyName == null) + throw new JsonException("Cannot write null property SpecialModelName.SpecialPropertyName to non-nullable JSON property '$special[property.name]'."); + if (specialModelName.VarSpecialModelNameOption.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs index a5a5f43433ca..d0d4298cab55 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.IdOption.IsSet && tag.Id == null) + throw new JsonException("Cannot write null property Tag.Id to non-nullable JSON property 'id'."); + if (tag.NameOption.IsSet && tag.Name == null) throw new JsonException("Cannot write null property Tag.Name to non-nullable JSON property 'name'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs index 9237807a5896..e367448c907f 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/TestResult.cs @@ -222,6 +222,9 @@ public override void Write(Utf8JsonWriter writer, TestResult testResult, JsonSer /// public void WriteProperties(Utf8JsonWriter writer, TestResult testResult, JsonSerializerOptions jsonSerializerOptions) { + if (testResult.CodeOption.IsSet && testResult.Code == null) + throw new JsonException("Cannot write null property TestResult.Code to non-nullable JSON property 'code'."); + if (testResult.DataOption.IsSet && testResult.Data == null) throw new JsonException("Cannot write null property TestResult.Data to non-nullable JSON property 'data'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs index 723e1590f152..dd4db4f456f1 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -429,6 +429,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.FirstNameOption.IsSet && user.FirstName == null) throw new JsonException("Cannot write null property User.FirstName to non-nullable JSON property 'firstName'."); + if (user.IdOption.IsSet && user.Id == null) + throw new JsonException("Cannot write null property User.Id to non-nullable JSON property 'id'."); + if (user.LastNameOption.IsSet && user.LastName == null) throw new JsonException("Cannot write null property User.LastName to non-nullable JSON property 'lastName'."); @@ -441,6 +444,9 @@ public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOpti if (user.PhoneOption.IsSet && user.Phone == null) throw new JsonException("Cannot write null property User.Phone to non-nullable JSON property 'phone'."); + if (user.UserStatusOption.IsSet && user.UserStatus == null) + throw new JsonException("Cannot write null property User.UserStatus to non-nullable JSON property 'userStatus'."); + if (user.UsernameOption.IsSet && user.Username == null) throw new JsonException("Cannot write null property User.Username to non-nullable JSON property 'username'."); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs index 2dc6b12e05d8..c1abfbfd12c0 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.HasBaleenOption.IsSet && whale.HasBaleen == null) + throw new JsonException("Cannot write null property Whale.HasBaleen to non-nullable JSON property 'hasBaleen'."); + + if (whale.HasTeethOption.IsSet && whale.HasTeeth == null) + throw new JsonException("Cannot write null property Whale.HasTeeth to non-nullable JSON property 'hasTeeth'."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Zebra.cs index 573b37ce6c98..c6144e93c73d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -280,6 +280,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.TypeOption.IsSet && zebra.Type == null) + throw new JsonException("Cannot write null property Zebra.Type to non-nullable JSON property 'type'."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index e8cf530a9235..4ce3561c85ec 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet && zeroBasedEnumClass.ZeroBasedEnum == null) + throw new JsonException("Cannot write null property ZeroBasedEnumClass.ZeroBasedEnum to non-nullable JSON property 'ZeroBasedEnum'."); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); }