From 55de8099ef3b6c57bf65ecaff49d55a1b18b7c75 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 21 Mar 2021 08:32:38 -0700 Subject: [PATCH 1/6] Turns on setting model.additionalProperties for composed schemas when supportsAdditionalPropertiesWithComposedSchema is true, tests updated for v2 and v3 specs --- .../openapitools/codegen/DefaultCodegen.java | 9 +- .../codegen/DefaultCodegenTest.java | 244 ++++++++++++++---- .../additional-properties-for-testing.yaml | 12 + 3 files changed, 219 insertions(+), 46 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 5155526a4d36..e28b3ad1156e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -2615,6 +2615,13 @@ public int compare(CodegenProperty one, CodegenProperty another) { } private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){ + if (schema.equals(new Schema())) { + // if we are trying to set additionalProperties on an empty schema stop recursing + return; + } + if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) { + return; + } CodegenModel m = null; if (property instanceof CodegenModel) { m = (CodegenModel) property; @@ -6157,6 +6164,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S } private void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property){ + setAddProps(schema, property); if (!"object".equals(schema.getType())) { return; } @@ -6178,7 +6186,6 @@ private void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValida property.setHasRequired(true); } } - setAddProps(schema, property); } private void addJsonSchemaForBodyRequestInCaseItsNotPresent(CodegenParameter codegenParameter, RequestBody body) { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 17c5864fe008..f6608bada503 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -240,7 +240,7 @@ public void testOriginalOpenApiDocumentVersion() { } @Test - public void testAdditionalPropertiesV2Spec() { + public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPresentTrue() { OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/additional-properties-for-testing.yaml"); DefaultCodegen codegen = new DefaultCodegen(); codegen.setOpenAPI(openAPI); @@ -254,111 +254,269 @@ public void testAdditionalPropertiesV2Spec() { // 'additionalProperties' keyword for this model, hence assert the value to be null. Assert.assertNull(addProps); CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", schema); + Assert.assertNull(cm.getAdditionalProperties()); // When the 'additionalProperties' keyword is not present, the model // should allow undeclared properties. However, due to bug // https://github.com/swagger-api/swagger-parser/issues/1369, the swagger // converter does not retain the value of the additionalProperties. - Map m = schema.getProperties(); - Schema child = m.get("map_string"); + Map modelPropSchems = schema.getProperties(); + Schema map_string_sc = modelPropSchems.get("map_string"); + CodegenProperty map_string_cp = null; + Schema map_with_additional_properties_sc = modelPropSchems.get("map_with_additional_properties"); + CodegenProperty map_with_additional_properties_cp = null; + Schema map_without_additional_properties_sc = modelPropSchems.get("map_without_additional_properties");; + CodegenProperty map_without_additional_properties_cp = null; + + for(CodegenProperty cp: cm.vars) { + if (cp.baseName.equals("map_string")) { + map_string_cp = cp; + } else if (cp.baseName.equals("map_with_additional_properties")) { + map_with_additional_properties_cp = cp; + } else if (cp.baseName.equals("map_without_additional_properties")) { + map_without_additional_properties_cp = cp; + } + } + + // map_string // This property has the following inline schema. // additionalProperties: // type: string - Assert.assertNotNull(child); - Assert.assertNotNull(child.getAdditionalProperties()); + Assert.assertNotNull(map_string_sc); + Assert.assertNotNull(map_string_sc.getAdditionalProperties()); + Assert.assertNotNull(map_string_cp.getAdditionalProperties()); - child = m.get("map_with_additional_properties"); + // map_with_additional_properties // This property has the following inline schema. // additionalProperties: true - Assert.assertNotNull(child); + Assert.assertNotNull(map_with_additional_properties_sc); // It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema. // We cannot differentiate between 'additionalProperties' not present and // additionalProperties: true. - Assert.assertNull(child.getAdditionalProperties()); - addProps = ModelUtils.getAdditionalProperties(openAPI, child); + Assert.assertNull(map_with_additional_properties_sc.getAdditionalProperties()); + addProps = ModelUtils.getAdditionalProperties(openAPI, map_with_additional_properties_sc); Assert.assertNull(addProps); + Assert.assertNull(map_with_additional_properties_cp.getAdditionalProperties()); - child = m.get("map_without_additional_properties"); + // map_without_additional_properties // This property has the following inline schema. // additionalProperties: false - Assert.assertNotNull(child); + Assert.assertNotNull(map_without_additional_properties_sc); // It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema. // We cannot differentiate between 'additionalProperties' not present and // additionalProperties: false. - Assert.assertNull(child.getAdditionalProperties()); - addProps = ModelUtils.getAdditionalProperties(openAPI, child); + Assert.assertNull(map_without_additional_properties_sc.getAdditionalProperties()); + addProps = ModelUtils.getAdditionalProperties(openAPI, map_without_additional_properties_sc); Assert.assertNull(addProps); + Assert.assertNull(map_without_additional_properties_cp.getAdditionalProperties()); + + // check of composed schema model + String schemaName = "Parent"; + schema = openAPI.getComponents().getSchemas().get(schemaName); + cm = codegen.fromModel(schemaName, schema); + Assert.assertNull(cm.getAdditionalProperties()); } @Test - public void testAdditionalPropertiesV3Spec() { + public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPresentFalse() { + OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/additional-properties-for-testing.yaml"); + DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + codegen.setDisallowAdditionalPropertiesIfNotPresent(false); + codegen.supportsAdditionalPropertiesWithComposedSchema = true; + /* + when this DisallowAdditionalPropertiesIfNotPresent is false: + for CodegenModel/CodegenParameter/CodegenProperty/CodegenResponse.getAdditionalProperties + if the input additionalProperties is False or unset (null) + .getAdditionalProperties is set to AnyTypeSchema + + For the False value this is incorrect, but it is the best that we can do because of this bug: + https://github.com/swagger-api/swagger-parser/issues/1369 where swagger parser + sets both null/False additionalProperties to null + */ + + Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass"); + Assert.assertEquals(schema.getAdditionalProperties(), null); + + Schema addProps = ModelUtils.getAdditionalProperties(openAPI, schema); + // The petstore-with-fake-endpoints-models-for-testing.yaml does not set the + // 'additionalProperties' keyword for this model, hence assert the value to be null. + Assert.assertNull(addProps); + CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", schema); + Assert.assertNotNull(cm.getAdditionalProperties()); + // When the 'additionalProperties' keyword is not present, the model + // should allow undeclared properties. However, due to bug + // https://github.com/swagger-api/swagger-parser/issues/1369, the swagger + // converter does not retain the value of the additionalProperties. + + Map modelPropSchems = schema.getProperties(); + Schema map_string_sc = modelPropSchems.get("map_string"); + CodegenProperty map_string_cp = null; + Schema map_with_additional_properties_sc = modelPropSchems.get("map_with_additional_properties"); + CodegenProperty map_with_additional_properties_cp = null; + Schema map_without_additional_properties_sc = modelPropSchems.get("map_without_additional_properties");; + CodegenProperty map_without_additional_properties_cp = null; + + for(CodegenProperty cp: cm.vars) { + if (cp.baseName.equals("map_string")) { + map_string_cp = cp; + } else if (cp.baseName.equals("map_with_additional_properties")) { + map_with_additional_properties_cp = cp; + } else if (cp.baseName.equals("map_without_additional_properties")) { + map_without_additional_properties_cp = cp; + } + } + + // map_string + // This property has the following inline schema. + // additionalProperties: + // type: string + Assert.assertNotNull(map_string_sc); + Assert.assertNotNull(map_string_sc.getAdditionalProperties()); + Assert.assertNotNull(map_string_cp.getAdditionalProperties()); + + // map_with_additional_properties + // This property has the following inline schema. + // additionalProperties: true + Assert.assertNotNull(map_with_additional_properties_sc); + // It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema. + // We cannot differentiate between 'additionalProperties' not present and + // additionalProperties: true. + Assert.assertNull(map_with_additional_properties_sc.getAdditionalProperties()); + addProps = ModelUtils.getAdditionalProperties(openAPI, map_with_additional_properties_sc); + Assert.assertNull(addProps); + Assert.assertNotNull(map_with_additional_properties_cp.getAdditionalProperties()); + + // map_without_additional_properties + // This property has the following inline schema. + // additionalProperties: false + Assert.assertNotNull(map_without_additional_properties_sc); + // It is unfortunate that child.getAdditionalProperties() returns null for a V2 schema. + // We cannot differentiate between 'additionalProperties' not present and + // additionalProperties: false. + Assert.assertNull(map_without_additional_properties_sc.getAdditionalProperties()); + addProps = ModelUtils.getAdditionalProperties(openAPI, map_without_additional_properties_sc); + Assert.assertNull(addProps); + Assert.assertNotNull(map_without_additional_properties_cp.getAdditionalProperties()); + + // check of composed schema model + String schemaName = "Parent"; + schema = openAPI.getComponents().getSchemas().get(schemaName); + cm = codegen.fromModel(schemaName, schema); + Assert.assertNotNull(cm.getAdditionalProperties()); + } + + @Test + public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPresentFalse() { OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml"); DefaultCodegen codegen = new DefaultCodegen(); codegen.setDisallowAdditionalPropertiesIfNotPresent(false); + codegen.supportsAdditionalPropertiesWithComposedSchema = true; codegen.setOpenAPI(openAPI); - Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass"); - Assert.assertNull(schema.getAdditionalProperties()); + Schema componentSchema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass"); + Assert.assertNull(componentSchema.getAdditionalProperties()); // When the 'additionalProperties' keyword is not present, the schema may be // extended with any undeclared properties. - Schema addProps = ModelUtils.getAdditionalProperties(openAPI, schema); + Schema addProps = ModelUtils.getAdditionalProperties(openAPI, componentSchema); Assert.assertNotNull(addProps); Assert.assertTrue(addProps instanceof ObjectSchema); - CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", schema); + CodegenModel cm = codegen.fromModel("AdditionalPropertiesClass", componentSchema); + Assert.assertNotNull(cm.getAdditionalProperties()); + + Map modelPropSchems = componentSchema.getProperties(); + Schema map_with_undeclared_properties_string_sc = modelPropSchems.get("map_with_undeclared_properties_string"); + CodegenProperty map_with_undeclared_properties_string_cp = null; + Schema map_with_undeclared_properties_anytype_1_sc = modelPropSchems.get("map_with_undeclared_properties_anytype_1"); + CodegenProperty map_with_undeclared_properties_anytype_1_cp = null; + Schema map_with_undeclared_properties_anytype_2_sc = modelPropSchems.get("map_with_undeclared_properties_anytype_2"); + CodegenProperty map_with_undeclared_properties_anytype_2_cp = null; + Schema map_with_undeclared_properties_anytype_3_sc = modelPropSchems.get("map_with_undeclared_properties_anytype_3"); + CodegenProperty map_with_undeclared_properties_anytype_3_cp = null; + Schema empty_map_sc = modelPropSchems.get("empty_map"); + CodegenProperty empty_map_cp = null; + + for(CodegenProperty cp: cm.vars) { + if (cp.baseName.equals("map_with_undeclared_properties_string")) { + map_with_undeclared_properties_string_cp = cp; + } else if (cp.baseName.equals("map_with_undeclared_properties_anytype_1")) { + map_with_undeclared_properties_anytype_1_cp = cp; + } else if (cp.baseName.equals("map_with_undeclared_properties_anytype_2")) { + map_with_undeclared_properties_anytype_2_cp = cp; + } else if (cp.baseName.equals("map_with_undeclared_properties_anytype_3")) { + map_with_undeclared_properties_anytype_3_cp = cp; + } else if (cp.baseName.equals("empty_map")) { + empty_map_cp = cp; + } + } - Map m = schema.getProperties(); - Schema child = m.get("map_with_undeclared_properties_string"); + // map_with_undeclared_properties_string // This property has the following inline schema. // additionalProperties: // type: string - Assert.assertNotNull(child); - Assert.assertNotNull(child.getAdditionalProperties()); + Assert.assertNotNull(map_with_undeclared_properties_string_sc); + Assert.assertNotNull(map_with_undeclared_properties_string_sc.getAdditionalProperties()); + Assert.assertNotNull(map_with_undeclared_properties_string_cp.getAdditionalProperties()); - child = m.get("map_with_undeclared_properties_anytype_1"); + // map_with_undeclared_properties_anytype_1 // This property does not use the additionalProperties keyword, // which means by default undeclared properties are allowed. - Assert.assertNotNull(child); - Assert.assertNull(child.getAdditionalProperties()); - addProps = ModelUtils.getAdditionalProperties(openAPI, child); + Assert.assertNotNull(map_with_undeclared_properties_anytype_1_sc); + Assert.assertNull(map_with_undeclared_properties_anytype_1_sc.getAdditionalProperties()); + addProps = ModelUtils.getAdditionalProperties(openAPI, map_with_undeclared_properties_anytype_1_sc); Assert.assertNotNull(addProps); Assert.assertTrue(addProps instanceof ObjectSchema); + Assert.assertNotNull(map_with_undeclared_properties_anytype_1_cp.getAdditionalProperties()); - child = m.get("map_with_undeclared_properties_anytype_2"); + // map_with_undeclared_properties_anytype_2 // This property does not use the additionalProperties keyword, // which means by default undeclared properties are allowed. - Assert.assertNotNull(child); - Assert.assertNull(child.getAdditionalProperties()); - addProps = ModelUtils.getAdditionalProperties(openAPI, child); + Assert.assertNotNull(map_with_undeclared_properties_anytype_2_sc); + Assert.assertNull(map_with_undeclared_properties_anytype_2_sc.getAdditionalProperties()); + addProps = ModelUtils.getAdditionalProperties(openAPI, map_with_undeclared_properties_anytype_2_sc); Assert.assertNotNull(addProps); Assert.assertTrue(addProps instanceof ObjectSchema); + Assert.assertNotNull(map_with_undeclared_properties_anytype_2_cp.getAdditionalProperties()); - child = m.get("map_with_undeclared_properties_anytype_3"); + // map_with_undeclared_properties_anytype_3 // This property has the following inline schema. // additionalProperties: true - Assert.assertNotNull(child); + Assert.assertNotNull(map_with_undeclared_properties_anytype_3_sc); // Unlike the V2 spec, in V3 we CAN differentiate between 'additionalProperties' not present and // additionalProperties: true. - Assert.assertNotNull(child.getAdditionalProperties()); - Assert.assertEquals(child.getAdditionalProperties(), Boolean.TRUE); - addProps = ModelUtils.getAdditionalProperties(openAPI, child); + Assert.assertNotNull(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties()); + Assert.assertEquals(map_with_undeclared_properties_anytype_3_sc.getAdditionalProperties(), Boolean.TRUE); + addProps = ModelUtils.getAdditionalProperties(openAPI, map_with_undeclared_properties_anytype_3_sc); Assert.assertNotNull(addProps); Assert.assertTrue(addProps instanceof ObjectSchema); + Assert.assertNotNull(map_with_undeclared_properties_anytype_3_cp.getAdditionalProperties()); - child = m.get("empty_map"); + // empty_map // This property has the following inline schema. // additionalProperties: false - Assert.assertNotNull(child); + Assert.assertNotNull(empty_map_sc); // Unlike the V2 spec, in V3 we CAN differentiate between 'additionalProperties' not present and // additionalProperties: false. - Assert.assertNotNull(child.getAdditionalProperties()); - Assert.assertEquals(child.getAdditionalProperties(), Boolean.FALSE); - addProps = ModelUtils.getAdditionalProperties(openAPI, child); + Assert.assertNotNull(empty_map_sc.getAdditionalProperties()); + Assert.assertEquals(empty_map_sc.getAdditionalProperties(), Boolean.FALSE); + addProps = ModelUtils.getAdditionalProperties(openAPI, empty_map_sc); Assert.assertNull(addProps); + Assert.assertNull(empty_map_cp.getAdditionalProperties()); + + // check of composed schema model + String schemaName = "SomeObject"; + Schema schema = openAPI.getComponents().getSchemas().get(schemaName); + cm = codegen.fromModel(schemaName, schema); + Assert.assertNotNull(cm.getAdditionalProperties()); } @Test - public void testAdditionalPropertiesV3SpecLegacy() { + public void testAdditionalPropertiesV3SpecDisallowAdditionalPropertiesIfNotPresentTrue() { + // As per OAS spec, when the 'additionalProperties' keyword is not present, the schema may be + // extended with any undeclared properties. + // However, in legacy 'additionalProperties' mode, this is interpreted as + // 'no additional properties are allowed'. OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml"); DefaultCodegen codegen = new DefaultCodegen(); codegen.setDisallowAdditionalPropertiesIfNotPresent(true); @@ -367,10 +525,6 @@ public void testAdditionalPropertiesV3SpecLegacy() { Schema schema = openAPI.getComponents().getSchemas().get("AdditionalPropertiesClass"); Assert.assertNull(schema.getAdditionalProperties()); - // As per OAS spec, when the 'additionalProperties' keyword is not present, the schema may be - // extended with any undeclared properties. - // However, in legacy 'additionalProperties' mode, this is interpreted as - // 'no additional properties are allowed'. Schema addProps = ModelUtils.getAdditionalProperties(openAPI, schema); Assert.assertNull(addProps); } diff --git a/modules/openapi-generator/src/test/resources/2_0/additional-properties-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/additional-properties-for-testing.yaml index 5cfa74c27c8f..2864ab034c22 100644 --- a/modules/openapi-generator/src/test/resources/2_0/additional-properties-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/additional-properties-for-testing.yaml @@ -9,6 +9,18 @@ info: host: petstore.swagger.io:80 basePath: /v2 definitions: + Grandparent: + type: object + properties: + radioWaves: + type: boolean + Parent: + allOf: + - $ref: '#/definitions/Grandparent' + - type: object + properties: + teleVision: + type: boolean AdditionalPropertiesClass: type: object properties: From 1dee38b13adff935cf0748ad1842bad4fcd6e0f9 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 21 Mar 2021 09:13:25 -0700 Subject: [PATCH 2/6] Comment change --- .../test/java/org/openapitools/codegen/DefaultCodegenTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index f6608bada503..24eb9b6db898 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -241,6 +241,7 @@ public void testOriginalOpenApiDocumentVersion() { @Test public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPresentTrue() { + // this is the legacy config that most of our tooling uses OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/additional-properties-for-testing.yaml"); DefaultCodegen codegen = new DefaultCodegen(); codegen.setOpenAPI(openAPI); @@ -325,7 +326,7 @@ public void testAdditionalPropertiesV2SpecDisallowAdditionalPropertiesIfNotPrese codegen.setDisallowAdditionalPropertiesIfNotPresent(false); codegen.supportsAdditionalPropertiesWithComposedSchema = true; /* - when this DisallowAdditionalPropertiesIfNotPresent is false: + When this DisallowAdditionalPropertiesIfNotPresent is false: for CodegenModel/CodegenParameter/CodegenProperty/CodegenResponse.getAdditionalProperties if the input additionalProperties is False or unset (null) .getAdditionalProperties is set to AnyTypeSchema From f9e2ddfc334b77d7e84904952322b37d3409d569 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 21 Mar 2021 14:47:19 -0700 Subject: [PATCH 3/6] Samples updated --- .../src/Org.OpenAPITools/Model/Cat.cs | 15 +---- .../src/Org.OpenAPITools/Model/ChildCat.cs | 15 +---- .../Model/ComplexQuadrilateral.cs | 15 +---- .../src/Org.OpenAPITools/Model/Dog.cs | 15 +---- .../Model/EquilateralTriangle.cs | 15 +---- .../src/Org.OpenAPITools/Model/ParentPet.cs | 15 +---- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 15 +---- .../Model/SimpleQuadrilateral.cs | 15 +---- .../src/Org.OpenAPITools/Model/Cat.cs | 15 +---- .../src/Org.OpenAPITools/Model/ChildCat.cs | 15 +---- .../Model/ComplexQuadrilateral.cs | 15 +---- .../src/Org.OpenAPITools/Model/Dog.cs | 15 +---- .../Model/EquilateralTriangle.cs | 15 +---- .../src/Org.OpenAPITools/Model/ParentPet.cs | 15 +---- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 15 +---- .../Model/SimpleQuadrilateral.cs | 15 +---- .../src/Org.OpenAPITools/Model/Cat.cs | 15 +---- .../src/Org.OpenAPITools/Model/ChildCat.cs | 15 +---- .../Model/ComplexQuadrilateral.cs | 15 +---- .../src/Org.OpenAPITools/Model/Dog.cs | 15 +---- .../Model/EquilateralTriangle.cs | 15 +---- .../src/Org.OpenAPITools/Model/ParentPet.cs | 15 +---- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 15 +---- .../Model/SimpleQuadrilateral.cs | 15 +---- .../src/Org.OpenAPITools/Model/Cat.cs | 15 +---- .../src/Org.OpenAPITools/Model/ChildCat.cs | 15 +---- .../Model/ComplexQuadrilateral.cs | 15 +---- .../src/Org.OpenAPITools/Model/Dog.cs | 15 +---- .../Model/EquilateralTriangle.cs | 15 +---- .../src/Org.OpenAPITools/Model/ParentPet.cs | 15 +---- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 15 +---- .../Model/SimpleQuadrilateral.cs | 15 +---- .../petstore/go/go-petstore/model_cat.go | 64 ------------------- .../petstore/go/go-petstore/model_dog.go | 64 ------------------- 34 files changed, 32 insertions(+), 576 deletions(-) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs index 1c6fa0f4220b..e06a1195ef25 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs @@ -38,10 +38,7 @@ public partial class Cat : Animal, IEquatable, IValidatableObject /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Cat() - { - this.AdditionalProperties = new Dictionary(); - } + protected Cat() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected Cat() public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; - this.AdditionalProperties = new Dictionary(); } /// @@ -60,12 +56,6 @@ protected Cat() [DataMember(Name = "declawed", EmitDefaultValue = false)] public bool Declawed { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -76,7 +66,6 @@ public override string ToString() sb.Append("class Cat {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -120,8 +109,6 @@ public override int GetHashCode() { int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs index 8c2d77ca45d0..8070a78eddb0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs @@ -57,10 +57,7 @@ public enum PetTypeEnum /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ChildCat() - { - this.AdditionalProperties = new Dictionary(); - } + protected ChildCat() { } /// /// Initializes a new instance of the class. /// @@ -70,7 +67,6 @@ protected ChildCat() { this.PetType = petType; this.Name = name; - this.AdditionalProperties = new Dictionary(); } /// @@ -79,12 +75,6 @@ protected ChildCat() [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -96,7 +86,6 @@ public override string ToString() sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -142,8 +131,6 @@ public override int GetHashCode() if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 78f3c6c03e3a..642175118700 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -36,10 +36,7 @@ public partial class ComplexQuadrilateral : IEquatable, IV /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ComplexQuadrilateral() - { - this.AdditionalProperties = new Dictionary(); - } + protected ComplexQuadrilateral() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected ComplexQuadrilateral() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected ComplexQuadrilateral() [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class ComplexQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs index 1ff9ab1624dc..ec5e3c5f9f20 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs @@ -38,10 +38,7 @@ public partial class Dog : Animal, IEquatable, IValidatableObject /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Dog() - { - this.AdditionalProperties = new Dictionary(); - } + protected Dog() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected Dog() public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; - this.AdditionalProperties = new Dictionary(); } /// @@ -60,12 +56,6 @@ protected Dog() [DataMember(Name = "breed", EmitDefaultValue = false)] public string Breed { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -76,7 +66,6 @@ public override string ToString() sb.Append("class Dog {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -121,8 +110,6 @@ public override int GetHashCode() int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index ed443f68cf77..e16ced021f31 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -36,10 +36,7 @@ public partial class EquilateralTriangle : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EquilateralTriangle() - { - this.AdditionalProperties = new Dictionary(); - } + protected EquilateralTriangle() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected EquilateralTriangle() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected EquilateralTriangle() [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class EquilateralTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs index a205b59b6d09..26e9275891d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs @@ -39,25 +39,15 @@ public partial class ParentPet : GrandparentAnimal, IEquatable, IVali /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ParentPet() - { - this.AdditionalProperties = new Dictionary(); - } + protected ParentPet() { } /// /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). public ParentPet(string petType = "ParentPet") : base(petType) { - this.AdditionalProperties = new Dictionary(); } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -67,7 +57,6 @@ public override string ToString() var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -110,8 +99,6 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index c539590907c7..46b9eaf7afc6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -36,10 +36,7 @@ public partial class ScaleneTriangle : IEquatable, IValidatable /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ScaleneTriangle() - { - this.AdditionalProperties = new Dictionary(); - } + protected ScaleneTriangle() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected ScaleneTriangle() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected ScaleneTriangle() [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class ScaleneTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 5280a0c308a7..f16798ec1d13 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -36,10 +36,7 @@ public partial class SimpleQuadrilateral : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected SimpleQuadrilateral() - { - this.AdditionalProperties = new Dictionary(); - } + protected SimpleQuadrilateral() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected SimpleQuadrilateral() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected SimpleQuadrilateral() [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class SimpleQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs index 1c6fa0f4220b..e06a1195ef25 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs @@ -38,10 +38,7 @@ public partial class Cat : Animal, IEquatable, IValidatableObject /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Cat() - { - this.AdditionalProperties = new Dictionary(); - } + protected Cat() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected Cat() public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; - this.AdditionalProperties = new Dictionary(); } /// @@ -60,12 +56,6 @@ protected Cat() [DataMember(Name = "declawed", EmitDefaultValue = false)] public bool Declawed { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -76,7 +66,6 @@ public override string ToString() sb.Append("class Cat {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -120,8 +109,6 @@ public override int GetHashCode() { int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs index 8c2d77ca45d0..8070a78eddb0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs @@ -57,10 +57,7 @@ public enum PetTypeEnum /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ChildCat() - { - this.AdditionalProperties = new Dictionary(); - } + protected ChildCat() { } /// /// Initializes a new instance of the class. /// @@ -70,7 +67,6 @@ protected ChildCat() { this.PetType = petType; this.Name = name; - this.AdditionalProperties = new Dictionary(); } /// @@ -79,12 +75,6 @@ protected ChildCat() [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -96,7 +86,6 @@ public override string ToString() sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -142,8 +131,6 @@ public override int GetHashCode() if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 78f3c6c03e3a..642175118700 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -36,10 +36,7 @@ public partial class ComplexQuadrilateral : IEquatable, IV /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ComplexQuadrilateral() - { - this.AdditionalProperties = new Dictionary(); - } + protected ComplexQuadrilateral() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected ComplexQuadrilateral() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected ComplexQuadrilateral() [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class ComplexQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs index 1ff9ab1624dc..ec5e3c5f9f20 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs @@ -38,10 +38,7 @@ public partial class Dog : Animal, IEquatable, IValidatableObject /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Dog() - { - this.AdditionalProperties = new Dictionary(); - } + protected Dog() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected Dog() public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; - this.AdditionalProperties = new Dictionary(); } /// @@ -60,12 +56,6 @@ protected Dog() [DataMember(Name = "breed", EmitDefaultValue = false)] public string Breed { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -76,7 +66,6 @@ public override string ToString() sb.Append("class Dog {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -121,8 +110,6 @@ public override int GetHashCode() int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index ed443f68cf77..e16ced021f31 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -36,10 +36,7 @@ public partial class EquilateralTriangle : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EquilateralTriangle() - { - this.AdditionalProperties = new Dictionary(); - } + protected EquilateralTriangle() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected EquilateralTriangle() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected EquilateralTriangle() [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class EquilateralTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs index a205b59b6d09..26e9275891d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs @@ -39,25 +39,15 @@ public partial class ParentPet : GrandparentAnimal, IEquatable, IVali /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ParentPet() - { - this.AdditionalProperties = new Dictionary(); - } + protected ParentPet() { } /// /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). public ParentPet(string petType = "ParentPet") : base(petType) { - this.AdditionalProperties = new Dictionary(); } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -67,7 +57,6 @@ public override string ToString() var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -110,8 +99,6 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index c539590907c7..46b9eaf7afc6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -36,10 +36,7 @@ public partial class ScaleneTriangle : IEquatable, IValidatable /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ScaleneTriangle() - { - this.AdditionalProperties = new Dictionary(); - } + protected ScaleneTriangle() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected ScaleneTriangle() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected ScaleneTriangle() [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class ScaleneTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 5280a0c308a7..f16798ec1d13 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -36,10 +36,7 @@ public partial class SimpleQuadrilateral : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected SimpleQuadrilateral() - { - this.AdditionalProperties = new Dictionary(); - } + protected SimpleQuadrilateral() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected SimpleQuadrilateral() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected SimpleQuadrilateral() [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class SimpleQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs index 1c6fa0f4220b..e06a1195ef25 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs @@ -38,10 +38,7 @@ public partial class Cat : Animal, IEquatable, IValidatableObject /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Cat() - { - this.AdditionalProperties = new Dictionary(); - } + protected Cat() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected Cat() public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; - this.AdditionalProperties = new Dictionary(); } /// @@ -60,12 +56,6 @@ protected Cat() [DataMember(Name = "declawed", EmitDefaultValue = false)] public bool Declawed { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -76,7 +66,6 @@ public override string ToString() sb.Append("class Cat {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -120,8 +109,6 @@ public override int GetHashCode() { int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs index 8c2d77ca45d0..8070a78eddb0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -57,10 +57,7 @@ public enum PetTypeEnum /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ChildCat() - { - this.AdditionalProperties = new Dictionary(); - } + protected ChildCat() { } /// /// Initializes a new instance of the class. /// @@ -70,7 +67,6 @@ protected ChildCat() { this.PetType = petType; this.Name = name; - this.AdditionalProperties = new Dictionary(); } /// @@ -79,12 +75,6 @@ protected ChildCat() [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -96,7 +86,6 @@ public override string ToString() sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -142,8 +131,6 @@ public override int GetHashCode() if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 78f3c6c03e3a..642175118700 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -36,10 +36,7 @@ public partial class ComplexQuadrilateral : IEquatable, IV /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ComplexQuadrilateral() - { - this.AdditionalProperties = new Dictionary(); - } + protected ComplexQuadrilateral() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected ComplexQuadrilateral() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected ComplexQuadrilateral() [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class ComplexQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs index 1ff9ab1624dc..ec5e3c5f9f20 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs @@ -38,10 +38,7 @@ public partial class Dog : Animal, IEquatable, IValidatableObject /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Dog() - { - this.AdditionalProperties = new Dictionary(); - } + protected Dog() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected Dog() public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; - this.AdditionalProperties = new Dictionary(); } /// @@ -60,12 +56,6 @@ protected Dog() [DataMember(Name = "breed", EmitDefaultValue = false)] public string Breed { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -76,7 +66,6 @@ public override string ToString() sb.Append("class Dog {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -121,8 +110,6 @@ public override int GetHashCode() int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index ed443f68cf77..e16ced021f31 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -36,10 +36,7 @@ public partial class EquilateralTriangle : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EquilateralTriangle() - { - this.AdditionalProperties = new Dictionary(); - } + protected EquilateralTriangle() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected EquilateralTriangle() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected EquilateralTriangle() [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class EquilateralTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs index a205b59b6d09..26e9275891d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -39,25 +39,15 @@ public partial class ParentPet : GrandparentAnimal, IEquatable, IVali /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ParentPet() - { - this.AdditionalProperties = new Dictionary(); - } + protected ParentPet() { } /// /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). public ParentPet(string petType = "ParentPet") : base(petType) { - this.AdditionalProperties = new Dictionary(); } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -67,7 +57,6 @@ public override string ToString() var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -110,8 +99,6 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index c539590907c7..46b9eaf7afc6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -36,10 +36,7 @@ public partial class ScaleneTriangle : IEquatable, IValidatable /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ScaleneTriangle() - { - this.AdditionalProperties = new Dictionary(); - } + protected ScaleneTriangle() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected ScaleneTriangle() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected ScaleneTriangle() [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class ScaleneTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 5280a0c308a7..f16798ec1d13 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -36,10 +36,7 @@ public partial class SimpleQuadrilateral : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected SimpleQuadrilateral() - { - this.AdditionalProperties = new Dictionary(); - } + protected SimpleQuadrilateral() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected SimpleQuadrilateral() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected SimpleQuadrilateral() [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class SimpleQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs index 1c6fa0f4220b..e06a1195ef25 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs @@ -38,10 +38,7 @@ public partial class Cat : Animal, IEquatable, IValidatableObject /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Cat() - { - this.AdditionalProperties = new Dictionary(); - } + protected Cat() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected Cat() public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; - this.AdditionalProperties = new Dictionary(); } /// @@ -60,12 +56,6 @@ protected Cat() [DataMember(Name = "declawed", EmitDefaultValue = false)] public bool Declawed { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -76,7 +66,6 @@ public override string ToString() sb.Append("class Cat {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -120,8 +109,6 @@ public override int GetHashCode() { int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs index 8c2d77ca45d0..8070a78eddb0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs @@ -57,10 +57,7 @@ public enum PetTypeEnum /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ChildCat() - { - this.AdditionalProperties = new Dictionary(); - } + protected ChildCat() { } /// /// Initializes a new instance of the class. /// @@ -70,7 +67,6 @@ protected ChildCat() { this.PetType = petType; this.Name = name; - this.AdditionalProperties = new Dictionary(); } /// @@ -79,12 +75,6 @@ protected ChildCat() [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -96,7 +86,6 @@ public override string ToString() sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -142,8 +131,6 @@ public override int GetHashCode() if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 78f3c6c03e3a..642175118700 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -36,10 +36,7 @@ public partial class ComplexQuadrilateral : IEquatable, IV /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ComplexQuadrilateral() - { - this.AdditionalProperties = new Dictionary(); - } + protected ComplexQuadrilateral() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected ComplexQuadrilateral() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected ComplexQuadrilateral() [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class ComplexQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs index 1ff9ab1624dc..ec5e3c5f9f20 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs @@ -38,10 +38,7 @@ public partial class Dog : Animal, IEquatable, IValidatableObject /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Dog() - { - this.AdditionalProperties = new Dictionary(); - } + protected Dog() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected Dog() public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; - this.AdditionalProperties = new Dictionary(); } /// @@ -60,12 +56,6 @@ protected Dog() [DataMember(Name = "breed", EmitDefaultValue = false)] public string Breed { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -76,7 +66,6 @@ public override string ToString() sb.Append("class Dog {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -121,8 +110,6 @@ public override int GetHashCode() int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index ed443f68cf77..e16ced021f31 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -36,10 +36,7 @@ public partial class EquilateralTriangle : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EquilateralTriangle() - { - this.AdditionalProperties = new Dictionary(); - } + protected EquilateralTriangle() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected EquilateralTriangle() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected EquilateralTriangle() [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class EquilateralTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs index a205b59b6d09..26e9275891d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs @@ -39,25 +39,15 @@ public partial class ParentPet : GrandparentAnimal, IEquatable, IVali /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ParentPet() - { - this.AdditionalProperties = new Dictionary(); - } + protected ParentPet() { } /// /// Initializes a new instance of the class. /// /// petType (required) (default to "ParentPet"). public ParentPet(string petType = "ParentPet") : base(petType) { - this.AdditionalProperties = new Dictionary(); } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -67,7 +57,6 @@ public override string ToString() var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -110,8 +99,6 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = base.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index c539590907c7..46b9eaf7afc6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -36,10 +36,7 @@ public partial class ScaleneTriangle : IEquatable, IValidatable /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ScaleneTriangle() - { - this.AdditionalProperties = new Dictionary(); - } + protected ScaleneTriangle() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected ScaleneTriangle() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected ScaleneTriangle() [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class ScaleneTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 5280a0c308a7..f16798ec1d13 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -36,10 +36,7 @@ public partial class SimpleQuadrilateral : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected SimpleQuadrilateral() - { - this.AdditionalProperties = new Dictionary(); - } + protected SimpleQuadrilateral() { } /// /// Initializes a new instance of the class. /// @@ -51,7 +48,6 @@ protected SimpleQuadrilateral() this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); - this.AdditionalProperties = new Dictionary(); } /// @@ -66,12 +62,6 @@ protected SimpleQuadrilateral() [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - /// /// Returns the string presentation of the object /// @@ -82,7 +72,6 @@ public override string ToString() sb.Append("class SimpleQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -129,8 +118,6 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); - if (this.AdditionalProperties != null) - hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_cat.go b/samples/openapi3/client/petstore/go/go-petstore/model_cat.go index 972484d4dbdd..88ebf1b620a3 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/model_cat.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_cat.go @@ -12,19 +12,14 @@ package petstore import ( "encoding/json" - "reflect" - "strings" ) // Cat struct for Cat type Cat struct { Animal Declawed *bool `json:"declawed,omitempty"` - AdditionalProperties map[string]interface{} } -type _Cat Cat - // NewCat instantiates a new Cat object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -90,68 +85,9 @@ func (o Cat) MarshalJSON() ([]byte, error) { if o.Declawed != nil { toSerialize["declawed"] = o.Declawed } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) } -func (o *Cat) UnmarshalJSON(bytes []byte) (err error) { - type CatWithoutEmbeddedStruct struct { - Declawed *bool `json:"declawed,omitempty"` - } - - varCatWithoutEmbeddedStruct := CatWithoutEmbeddedStruct{} - - err = json.Unmarshal(bytes, &varCatWithoutEmbeddedStruct) - if err == nil { - varCat := _Cat{} - varCat.Declawed = varCatWithoutEmbeddedStruct.Declawed - *o = Cat(varCat) - } else { - return err - } - - varCat := _Cat{} - - err = json.Unmarshal(bytes, &varCat) - if err == nil { - o.Animal = varCat.Animal - } else { - return err - } - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - delete(additionalProperties, "declawed") - - // remove fields from embedded structs - reflectAnimal := reflect.ValueOf(o.Animal) - for i := 0; i < reflectAnimal.Type().NumField(); i++ { - t := reflectAnimal.Type().Field(i) - - if jsonTag := t.Tag.Get("json"); jsonTag != "" { - fieldName := "" - if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 { - fieldName = jsonTag[:commaIdx] - } else { - fieldName = jsonTag - } - if fieldName != "AdditionalProperties" { - delete(additionalProperties, fieldName) - } - } - } - - o.AdditionalProperties = additionalProperties - } - - return err -} - type NullableCat struct { value *Cat isSet bool diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_dog.go b/samples/openapi3/client/petstore/go/go-petstore/model_dog.go index 0da4e82a2635..e920fc4a987a 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/model_dog.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_dog.go @@ -12,19 +12,14 @@ package petstore import ( "encoding/json" - "reflect" - "strings" ) // Dog struct for Dog type Dog struct { Animal Breed *string `json:"breed,omitempty"` - AdditionalProperties map[string]interface{} } -type _Dog Dog - // NewDog instantiates a new Dog object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -90,68 +85,9 @@ func (o Dog) MarshalJSON() ([]byte, error) { if o.Breed != nil { toSerialize["breed"] = o.Breed } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) } -func (o *Dog) UnmarshalJSON(bytes []byte) (err error) { - type DogWithoutEmbeddedStruct struct { - Breed *string `json:"breed,omitempty"` - } - - varDogWithoutEmbeddedStruct := DogWithoutEmbeddedStruct{} - - err = json.Unmarshal(bytes, &varDogWithoutEmbeddedStruct) - if err == nil { - varDog := _Dog{} - varDog.Breed = varDogWithoutEmbeddedStruct.Breed - *o = Dog(varDog) - } else { - return err - } - - varDog := _Dog{} - - err = json.Unmarshal(bytes, &varDog) - if err == nil { - o.Animal = varDog.Animal - } else { - return err - } - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - delete(additionalProperties, "breed") - - // remove fields from embedded structs - reflectAnimal := reflect.ValueOf(o.Animal) - for i := 0; i < reflectAnimal.Type().NumField(); i++ { - t := reflectAnimal.Type().Field(i) - - if jsonTag := t.Tag.Get("json"); jsonTag != "" { - fieldName := "" - if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 { - fieldName = jsonTag[:commaIdx] - } else { - fieldName = jsonTag - } - if fieldName != "AdditionalProperties" { - delete(additionalProperties, fieldName) - } - } - } - - o.AdditionalProperties = additionalProperties - } - - return err -} - type NullableDog struct { value *Dog isSet bool From 1863b041e9dcc81c2a5e15b990740475765b195b Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 21 Mar 2021 15:04:54 -0700 Subject: [PATCH 4/6] Turns on supportsAdditionalPropertiesWithComposedSchema for CsharpNetCoreClient, samples regenerated --- .../languages/CSharpNetCoreClientCodegen.java | 2 ++ .../OpenAPIClient-httpclient/docs/Cat.md | 2 -- .../OpenAPIClient-httpclient/docs/Dog.md | 2 -- .../docs/ParentPet.md | 1 - .../src/Org.OpenAPITools/Model/Cat.cs | 27 +++++++++++++------ .../src/Org.OpenAPITools/Model/ChildCat.cs | 25 ++++++++++++----- .../Model/ComplexQuadrilateral.cs | 15 ++++++++++- .../src/Org.OpenAPITools/Model/Dog.cs | 27 +++++++++++++------ .../Model/EquilateralTriangle.cs | 15 ++++++++++- .../src/Org.OpenAPITools/Model/ParentPet.cs | 27 +++++++++++++------ .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 15 ++++++++++- .../Model/SimpleQuadrilateral.cs | 15 ++++++++++- .../OpenAPIClient-net47/docs/Cat.md | 2 -- .../OpenAPIClient-net47/docs/Dog.md | 2 -- .../OpenAPIClient-net47/docs/ParentPet.md | 1 - .../src/Org.OpenAPITools/Model/Cat.cs | 27 +++++++++++++------ .../src/Org.OpenAPITools/Model/ChildCat.cs | 25 ++++++++++++----- .../Model/ComplexQuadrilateral.cs | 15 ++++++++++- .../src/Org.OpenAPITools/Model/Dog.cs | 27 +++++++++++++------ .../Model/EquilateralTriangle.cs | 15 ++++++++++- .../src/Org.OpenAPITools/Model/ParentPet.cs | 27 +++++++++++++------ .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 15 ++++++++++- .../Model/SimpleQuadrilateral.cs | 15 ++++++++++- .../OpenAPIClient-net5.0/docs/Cat.md | 2 -- .../OpenAPIClient-net5.0/docs/Dog.md | 2 -- .../OpenAPIClient-net5.0/docs/ParentPet.md | 1 - .../src/Org.OpenAPITools/Model/Cat.cs | 27 +++++++++++++------ .../src/Org.OpenAPITools/Model/ChildCat.cs | 25 ++++++++++++----- .../Model/ComplexQuadrilateral.cs | 15 ++++++++++- .../src/Org.OpenAPITools/Model/Dog.cs | 27 +++++++++++++------ .../Model/EquilateralTriangle.cs | 15 ++++++++++- .../src/Org.OpenAPITools/Model/ParentPet.cs | 27 +++++++++++++------ .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 15 ++++++++++- .../Model/SimpleQuadrilateral.cs | 15 ++++++++++- .../csharp-netcore/OpenAPIClient/docs/Cat.md | 2 -- .../csharp-netcore/OpenAPIClient/docs/Dog.md | 2 -- .../OpenAPIClient/docs/ParentPet.md | 1 - .../src/Org.OpenAPITools/Model/Cat.cs | 27 +++++++++++++------ .../src/Org.OpenAPITools/Model/ChildCat.cs | 25 ++++++++++++----- .../Model/ComplexQuadrilateral.cs | 15 ++++++++++- .../src/Org.OpenAPITools/Model/Dog.cs | 27 +++++++++++++------ .../Model/EquilateralTriangle.cs | 15 ++++++++++- .../src/Org.OpenAPITools/Model/ParentPet.cs | 27 +++++++++++++------ .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 15 ++++++++++- .../Model/SimpleQuadrilateral.cs | 15 ++++++++++- .../OpenAPIClientCore/docs/Cat.md | 2 -- .../OpenAPIClientCore/docs/Dog.md | 2 -- .../OpenAPIClientCore/docs/ParentPet.md | 1 - .../src/Org.OpenAPITools/Model/Cat.cs | 12 ++++----- .../src/Org.OpenAPITools/Model/ChildCat.cs | 10 +++---- .../src/Org.OpenAPITools/Model/Dog.cs | 12 ++++----- .../src/Org.OpenAPITools/Model/ParentPet.cs | 12 ++++----- 52 files changed, 545 insertions(+), 192 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java index 87a6ae3faa7f..146a4983b822 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java @@ -215,6 +215,8 @@ public CSharpNetCoreClientCodegen() { disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts); cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt); this.setDisallowAdditionalPropertiesIfNotPresent(true); + // this generator supports additional properties in composed schemas + supportsAdditionalPropertiesWithComposedSchema = true; ImmutableMap.Builder frameworkBuilder = new ImmutableMap.Builder<>(); for (FrameworkStrategy frameworkStrategy : frameworkStrategies) { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Cat.md index aa1ac17604eb..0af324e1b9e0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Cat.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Dog.md index 3aa00144e9aa..b80771ade178 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Dog.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ParentPet.md index 0e18ba6d591d..381c00fd61fa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ParentPet.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs index e06a1195ef25..47cfdf57dda6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs @@ -32,22 +32,26 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : Animal, IEquatable, IValidatableObject + public partial class Cat : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Cat() { } + protected Cat() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// declawed. - /// className (required) (default to "Cat"). + /// className (required). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = default(string), string color = "red") { this.Declawed = declawed; + this.AdditionalProperties = new Dictionary(); } /// @@ -56,6 +60,12 @@ protected Cat() { } [DataMember(Name = "declawed", EmitDefaultValue = false)] public bool Declawed { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -64,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -74,7 +84,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,8 +117,10 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; hashCode = hashCode * 59 + this.Declawed.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -130,7 +142,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs index 8070a78eddb0..01115d4b13c1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : ParentPet, IEquatable, IValidatableObject + public partial class ChildCat : IEquatable, IValidatableObject { /// /// Defines PetType @@ -57,16 +57,20 @@ public enum PetTypeEnum /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ChildCat() { } + protected ChildCat() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) { this.PetType = petType; this.Name = name; + this.AdditionalProperties = new Dictionary(); } /// @@ -75,6 +79,12 @@ protected ChildCat() { } [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -83,9 +93,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -94,7 +104,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -127,10 +137,12 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -152,7 +164,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 642175118700..78f3c6c03e3a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -36,7 +36,10 @@ public partial class ComplexQuadrilateral : IEquatable, IV /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ComplexQuadrilateral() { } + protected ComplexQuadrilateral() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected ComplexQuadrilateral() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected ComplexQuadrilateral() { } [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class ComplexQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs index ec5e3c5f9f20..2ea30a5fd5e6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs @@ -32,22 +32,26 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : Animal, IEquatable, IValidatableObject + public partial class Dog : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Dog() { } + protected Dog() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// breed. - /// className (required) (default to "Dog"). + /// className (required). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = default(string), string color = "red") { this.Breed = breed; + this.AdditionalProperties = new Dictionary(); } /// @@ -56,6 +60,12 @@ protected Dog() { } [DataMember(Name = "breed", EmitDefaultValue = false)] public string Breed { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -64,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -74,7 +84,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,9 +117,11 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -131,7 +143,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index e16ced021f31..ed443f68cf77 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -36,7 +36,10 @@ public partial class EquilateralTriangle : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EquilateralTriangle() { } + protected EquilateralTriangle() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected EquilateralTriangle() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected EquilateralTriangle() { } [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class EquilateralTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs index 26e9275891d0..f2b2f671bbea 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,21 +33,31 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject + public partial class ParentPet : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ParentPet() { } + protected ParentPet() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// - /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + /// petType (required). + public ParentPet(string petType = default(string)) { + this.AdditionalProperties = new Dictionary(); } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -56,7 +66,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -65,7 +75,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -98,7 +108,9 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -120,7 +132,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 46b9eaf7afc6..c539590907c7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -36,7 +36,10 @@ public partial class ScaleneTriangle : IEquatable, IValidatable /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ScaleneTriangle() { } + protected ScaleneTriangle() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected ScaleneTriangle() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected ScaleneTriangle() { } [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class ScaleneTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index f16798ec1d13..5280a0c308a7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -36,7 +36,10 @@ public partial class SimpleQuadrilateral : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected SimpleQuadrilateral() { } + protected SimpleQuadrilateral() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected SimpleQuadrilateral() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected SimpleQuadrilateral() { } [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class SimpleQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Cat.md index aa1ac17604eb..0af324e1b9e0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Cat.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Dog.md index 3aa00144e9aa..b80771ade178 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Dog.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ParentPet.md index 0e18ba6d591d..381c00fd61fa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ParentPet.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs index e06a1195ef25..47cfdf57dda6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs @@ -32,22 +32,26 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : Animal, IEquatable, IValidatableObject + public partial class Cat : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Cat() { } + protected Cat() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// declawed. - /// className (required) (default to "Cat"). + /// className (required). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = default(string), string color = "red") { this.Declawed = declawed; + this.AdditionalProperties = new Dictionary(); } /// @@ -56,6 +60,12 @@ protected Cat() { } [DataMember(Name = "declawed", EmitDefaultValue = false)] public bool Declawed { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -64,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -74,7 +84,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,8 +117,10 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; hashCode = hashCode * 59 + this.Declawed.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -130,7 +142,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs index 8070a78eddb0..01115d4b13c1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : ParentPet, IEquatable, IValidatableObject + public partial class ChildCat : IEquatable, IValidatableObject { /// /// Defines PetType @@ -57,16 +57,20 @@ public enum PetTypeEnum /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ChildCat() { } + protected ChildCat() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) { this.PetType = petType; this.Name = name; + this.AdditionalProperties = new Dictionary(); } /// @@ -75,6 +79,12 @@ protected ChildCat() { } [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -83,9 +93,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -94,7 +104,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -127,10 +137,12 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -152,7 +164,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 642175118700..78f3c6c03e3a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -36,7 +36,10 @@ public partial class ComplexQuadrilateral : IEquatable, IV /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ComplexQuadrilateral() { } + protected ComplexQuadrilateral() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected ComplexQuadrilateral() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected ComplexQuadrilateral() { } [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class ComplexQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs index ec5e3c5f9f20..2ea30a5fd5e6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs @@ -32,22 +32,26 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : Animal, IEquatable, IValidatableObject + public partial class Dog : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Dog() { } + protected Dog() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// breed. - /// className (required) (default to "Dog"). + /// className (required). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = default(string), string color = "red") { this.Breed = breed; + this.AdditionalProperties = new Dictionary(); } /// @@ -56,6 +60,12 @@ protected Dog() { } [DataMember(Name = "breed", EmitDefaultValue = false)] public string Breed { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -64,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -74,7 +84,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,9 +117,11 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -131,7 +143,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index e16ced021f31..ed443f68cf77 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -36,7 +36,10 @@ public partial class EquilateralTriangle : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EquilateralTriangle() { } + protected EquilateralTriangle() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected EquilateralTriangle() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected EquilateralTriangle() { } [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class EquilateralTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs index 26e9275891d0..f2b2f671bbea 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,21 +33,31 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject + public partial class ParentPet : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ParentPet() { } + protected ParentPet() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// - /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + /// petType (required). + public ParentPet(string petType = default(string)) { + this.AdditionalProperties = new Dictionary(); } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -56,7 +66,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -65,7 +75,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -98,7 +108,9 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -120,7 +132,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 46b9eaf7afc6..c539590907c7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -36,7 +36,10 @@ public partial class ScaleneTriangle : IEquatable, IValidatable /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ScaleneTriangle() { } + protected ScaleneTriangle() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected ScaleneTriangle() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected ScaleneTriangle() { } [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class ScaleneTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index f16798ec1d13..5280a0c308a7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -36,7 +36,10 @@ public partial class SimpleQuadrilateral : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected SimpleQuadrilateral() { } + protected SimpleQuadrilateral() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected SimpleQuadrilateral() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected SimpleQuadrilateral() { } [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class SimpleQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Cat.md index aa1ac17604eb..0af324e1b9e0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Cat.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Dog.md index 3aa00144e9aa..b80771ade178 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Dog.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ParentPet.md index 0e18ba6d591d..381c00fd61fa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ParentPet.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs index e06a1195ef25..47cfdf57dda6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs @@ -32,22 +32,26 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : Animal, IEquatable, IValidatableObject + public partial class Cat : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Cat() { } + protected Cat() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// declawed. - /// className (required) (default to "Cat"). + /// className (required). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = default(string), string color = "red") { this.Declawed = declawed; + this.AdditionalProperties = new Dictionary(); } /// @@ -56,6 +60,12 @@ protected Cat() { } [DataMember(Name = "declawed", EmitDefaultValue = false)] public bool Declawed { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -64,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -74,7 +84,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,8 +117,10 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; hashCode = hashCode * 59 + this.Declawed.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -130,7 +142,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs index 8070a78eddb0..01115d4b13c1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : ParentPet, IEquatable, IValidatableObject + public partial class ChildCat : IEquatable, IValidatableObject { /// /// Defines PetType @@ -57,16 +57,20 @@ public enum PetTypeEnum /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ChildCat() { } + protected ChildCat() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) { this.PetType = petType; this.Name = name; + this.AdditionalProperties = new Dictionary(); } /// @@ -75,6 +79,12 @@ protected ChildCat() { } [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -83,9 +93,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -94,7 +104,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -127,10 +137,12 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -152,7 +164,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 642175118700..78f3c6c03e3a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -36,7 +36,10 @@ public partial class ComplexQuadrilateral : IEquatable, IV /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ComplexQuadrilateral() { } + protected ComplexQuadrilateral() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected ComplexQuadrilateral() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected ComplexQuadrilateral() { } [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class ComplexQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs index ec5e3c5f9f20..2ea30a5fd5e6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs @@ -32,22 +32,26 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : Animal, IEquatable, IValidatableObject + public partial class Dog : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Dog() { } + protected Dog() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// breed. - /// className (required) (default to "Dog"). + /// className (required). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = default(string), string color = "red") { this.Breed = breed; + this.AdditionalProperties = new Dictionary(); } /// @@ -56,6 +60,12 @@ protected Dog() { } [DataMember(Name = "breed", EmitDefaultValue = false)] public string Breed { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -64,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -74,7 +84,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,9 +117,11 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -131,7 +143,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index e16ced021f31..ed443f68cf77 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -36,7 +36,10 @@ public partial class EquilateralTriangle : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EquilateralTriangle() { } + protected EquilateralTriangle() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected EquilateralTriangle() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected EquilateralTriangle() { } [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class EquilateralTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs index 26e9275891d0..f2b2f671bbea 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,21 +33,31 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject + public partial class ParentPet : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ParentPet() { } + protected ParentPet() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// - /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + /// petType (required). + public ParentPet(string petType = default(string)) { + this.AdditionalProperties = new Dictionary(); } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -56,7 +66,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -65,7 +75,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -98,7 +108,9 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -120,7 +132,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 46b9eaf7afc6..c539590907c7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -36,7 +36,10 @@ public partial class ScaleneTriangle : IEquatable, IValidatable /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ScaleneTriangle() { } + protected ScaleneTriangle() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected ScaleneTriangle() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected ScaleneTriangle() { } [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class ScaleneTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index f16798ec1d13..5280a0c308a7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -36,7 +36,10 @@ public partial class SimpleQuadrilateral : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected SimpleQuadrilateral() { } + protected SimpleQuadrilateral() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected SimpleQuadrilateral() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected SimpleQuadrilateral() { } [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class SimpleQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Cat.md index aa1ac17604eb..0af324e1b9e0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Cat.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Dog.md index 3aa00144e9aa..b80771ade178 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Dog.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ParentPet.md index 0e18ba6d591d..381c00fd61fa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ParentPet.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs index e06a1195ef25..47cfdf57dda6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs @@ -32,22 +32,26 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : Animal, IEquatable, IValidatableObject + public partial class Cat : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Cat() { } + protected Cat() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// declawed. - /// className (required) (default to "Cat"). + /// className (required). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = default(string), string color = "red") { this.Declawed = declawed; + this.AdditionalProperties = new Dictionary(); } /// @@ -56,6 +60,12 @@ protected Cat() { } [DataMember(Name = "declawed", EmitDefaultValue = false)] public bool Declawed { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -64,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -74,7 +84,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,8 +117,10 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; hashCode = hashCode * 59 + this.Declawed.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -130,7 +142,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs index 8070a78eddb0..01115d4b13c1 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : ParentPet, IEquatable, IValidatableObject + public partial class ChildCat : IEquatable, IValidatableObject { /// /// Defines PetType @@ -57,16 +57,20 @@ public enum PetTypeEnum /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ChildCat() { } + protected ChildCat() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) { this.PetType = petType; this.Name = name; + this.AdditionalProperties = new Dictionary(); } /// @@ -75,6 +79,12 @@ protected ChildCat() { } [DataMember(Name = "name", EmitDefaultValue = false)] public string Name { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -83,9 +93,9 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -94,7 +104,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -127,10 +137,12 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -152,7 +164,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 642175118700..78f3c6c03e3a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -36,7 +36,10 @@ public partial class ComplexQuadrilateral : IEquatable, IV /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ComplexQuadrilateral() { } + protected ComplexQuadrilateral() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected ComplexQuadrilateral() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ComplexQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for ComplexQuadrilateral and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected ComplexQuadrilateral() { } [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class ComplexQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs index ec5e3c5f9f20..2ea30a5fd5e6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs @@ -32,22 +32,26 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : Animal, IEquatable, IValidatableObject + public partial class Dog : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected Dog() { } + protected Dog() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// /// breed. - /// className (required) (default to "Dog"). + /// className (required). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = default(string), string color = "red") { this.Breed = breed; + this.AdditionalProperties = new Dictionary(); } /// @@ -56,6 +60,12 @@ protected Dog() { } [DataMember(Name = "breed", EmitDefaultValue = false)] public string Breed { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -64,8 +74,8 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -74,7 +84,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,9 +117,11 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -131,7 +143,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index e16ced021f31..ed443f68cf77 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -36,7 +36,10 @@ public partial class EquilateralTriangle : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected EquilateralTriangle() { } + protected EquilateralTriangle() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected EquilateralTriangle() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for EquilateralTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for EquilateralTriangle and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected EquilateralTriangle() { } [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class EquilateralTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs index 26e9275891d0..f2b2f671bbea 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,21 +33,31 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject + public partial class ParentPet : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ParentPet() { } + protected ParentPet() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// - /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + /// petType (required). + public ParentPet(string petType = default(string)) { + this.AdditionalProperties = new Dictionary(); } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -56,7 +66,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -65,7 +75,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -98,7 +108,9 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } @@ -120,7 +132,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 46b9eaf7afc6..c539590907c7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -36,7 +36,10 @@ public partial class ScaleneTriangle : IEquatable, IValidatable /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected ScaleneTriangle() { } + protected ScaleneTriangle() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected ScaleneTriangle() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for ScaleneTriangle and cannot be null"); // to ensure "triangleType" is required (not null) this.TriangleType = triangleType ?? throw new ArgumentNullException("triangleType is a required property for ScaleneTriangle and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected ScaleneTriangle() { } [DataMember(Name = "triangleType", IsRequired = true, EmitDefaultValue = false)] public string TriangleType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class ScaleneTriangle {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.TriangleType != null) hashCode = hashCode * 59 + this.TriangleType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index f16798ec1d13..5280a0c308a7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -36,7 +36,10 @@ public partial class SimpleQuadrilateral : IEquatable, IVal /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - protected SimpleQuadrilateral() { } + protected SimpleQuadrilateral() + { + this.AdditionalProperties = new Dictionary(); + } /// /// Initializes a new instance of the class. /// @@ -48,6 +51,7 @@ protected SimpleQuadrilateral() { } this.ShapeType = shapeType ?? throw new ArgumentNullException("shapeType is a required property for SimpleQuadrilateral and cannot be null"); // to ensure "quadrilateralType" is required (not null) this.QuadrilateralType = quadrilateralType ?? throw new ArgumentNullException("quadrilateralType is a required property for SimpleQuadrilateral and cannot be null"); + this.AdditionalProperties = new Dictionary(); } /// @@ -62,6 +66,12 @@ protected SimpleQuadrilateral() { } [DataMember(Name = "quadrilateralType", IsRequired = true, EmitDefaultValue = false)] public string QuadrilateralType { get; set; } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + /// /// Returns the string presentation of the object /// @@ -72,6 +82,7 @@ public override string ToString() sb.Append("class SimpleQuadrilateral {\n"); sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -118,6 +129,8 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.ShapeType.GetHashCode(); if (this.QuadrilateralType != null) hashCode = hashCode * 59 + this.QuadrilateralType.GetHashCode(); + if (this.AdditionalProperties != null) + hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Cat.md index aa1ac17604eb..0af324e1b9e0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Cat.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Dog.md index 3aa00144e9aa..b80771ade178 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Dog.md @@ -4,8 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ParentPet.md index 0e18ba6d591d..381c00fd61fa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ParentPet.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs index e06a1195ef25..d726c67802e9 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : Animal, IEquatable, IValidatableObject + public partial class Cat : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -43,9 +43,9 @@ protected Cat() { } /// Initializes a new instance of the class. /// /// declawed. - /// className (required) (default to "Cat"). + /// className (required). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string className = default(string), string color = "red") { this.Declawed = declawed; } @@ -64,7 +64,6 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -74,7 +73,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,7 +106,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; hashCode = hashCode * 59 + this.Declawed.GetHashCode(); return hashCode; } @@ -130,7 +129,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ChildCat.cs index 8070a78eddb0..4b2cb633ce5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : ParentPet, IEquatable, IValidatableObject + public partial class ChildCat : IEquatable, IValidatableObject { /// /// Defines PetType @@ -63,7 +63,7 @@ protected ChildCat() { } /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) { this.PetType = petType; this.Name = name; @@ -83,7 +83,6 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); sb.Append("}\n"); @@ -94,7 +93,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -127,7 +126,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); @@ -152,7 +151,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs index ec5e3c5f9f20..d2cca8c3c458 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : Animal, IEquatable, IValidatableObject + public partial class Dog : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -43,9 +43,9 @@ protected Dog() { } /// Initializes a new instance of the class. /// /// breed. - /// className (required) (default to "Dog"). + /// className (required). /// color (default to "red"). - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string className = default(string), string color = "red") { this.Breed = breed; } @@ -64,7 +64,6 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -74,7 +73,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -107,7 +106,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); return hashCode; @@ -131,7 +130,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs index 26e9275891d0..311d390a9931 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,7 +33,7 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject + public partial class ParentPet : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -43,8 +43,8 @@ protected ParentPet() { } /// /// Initializes a new instance of the class. /// - /// petType (required) (default to "ParentPet"). - public ParentPet(string petType = "ParentPet") : base(petType) + /// petType (required). + public ParentPet(string petType = default(string)) { } @@ -56,7 +56,6 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); - sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -65,7 +64,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public override string ToJson() + public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -98,7 +97,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = base.GetHashCode(); + int hashCode = 41; return hashCode; } } @@ -120,7 +119,6 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } From 980aec535e99323362493607017afbb682f006c9 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 21 Mar 2021 17:48:26 -0700 Subject: [PATCH 5/6] Changes commented out, samples regnerated --- .../openapitools/codegen/DefaultCodegen.java | 17 +++++++++-------- .../languages/CSharpNetCoreClientCodegen.java | 3 ++- .../OpenAPIClient-httpclient/docs/Cat.md | 2 ++ .../OpenAPIClient-httpclient/docs/Dog.md | 2 ++ .../OpenAPIClient-httpclient/docs/ParentPet.md | 1 + .../src/Org.OpenAPITools/Model/Cat.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ChildCat.cs | 10 ++++++---- .../src/Org.OpenAPITools/Model/Dog.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ParentPet.cs | 12 +++++++----- .../OpenAPIClient-net47/docs/Cat.md | 2 ++ .../OpenAPIClient-net47/docs/Dog.md | 2 ++ .../OpenAPIClient-net47/docs/ParentPet.md | 1 + .../src/Org.OpenAPITools/Model/Cat.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ChildCat.cs | 10 ++++++---- .../src/Org.OpenAPITools/Model/Dog.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ParentPet.cs | 12 +++++++----- .../OpenAPIClient-net5.0/docs/Cat.md | 2 ++ .../OpenAPIClient-net5.0/docs/Dog.md | 2 ++ .../OpenAPIClient-net5.0/docs/ParentPet.md | 1 + .../src/Org.OpenAPITools/Model/Cat.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ChildCat.cs | 10 ++++++---- .../src/Org.OpenAPITools/Model/Dog.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ParentPet.cs | 12 +++++++----- .../csharp-netcore/OpenAPIClient/docs/Cat.md | 2 ++ .../csharp-netcore/OpenAPIClient/docs/Dog.md | 2 ++ .../OpenAPIClient/docs/ParentPet.md | 1 + .../src/Org.OpenAPITools/Model/Cat.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ChildCat.cs | 10 ++++++---- .../src/Org.OpenAPITools/Model/Dog.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ParentPet.cs | 12 +++++++----- .../OpenAPIClientCore/docs/Cat.md | 2 ++ .../OpenAPIClientCore/docs/Dog.md | 2 ++ .../OpenAPIClientCore/docs/ParentPet.md | 1 + .../src/Org.OpenAPITools/Model/Cat.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ChildCat.cs | 10 ++++++---- .../src/Org.OpenAPITools/Model/Dog.cs | 12 +++++++----- .../src/Org.OpenAPITools/Model/ParentPet.cs | 12 +++++++----- 37 files changed, 171 insertions(+), 104 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index e28b3ad1156e..f18c10fd4ca8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -2615,13 +2615,13 @@ public int compare(CodegenProperty one, CodegenProperty another) { } private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){ - if (schema.equals(new Schema())) { - // if we are trying to set additionalProperties on an empty schema stop recursing - return; - } - if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) { - return; - } +// if (schema.equals(new Schema())) { +// // if we are trying to set additionalProperties on an empty schema stop recursing +// return; +// } +// if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) { +// return; +// } CodegenModel m = null; if (property instanceof CodegenModel) { m = (CodegenModel) property; @@ -6164,10 +6164,11 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S } private void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property){ - setAddProps(schema, property); if (!"object".equals(schema.getType())) { return; } + // todo move this higher than the object check + setAddProps(schema, property); if (schema instanceof ObjectSchema) { ObjectSchema objSchema = (ObjectSchema) schema; HashSet requiredVars = new HashSet<>(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java index 146a4983b822..01d5d564ddc9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java @@ -216,7 +216,8 @@ public CSharpNetCoreClientCodegen() { cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt); this.setDisallowAdditionalPropertiesIfNotPresent(true); // this generator supports additional properties in composed schemas - supportsAdditionalPropertiesWithComposedSchema = true; + // TODO turn this on? + // supportsAdditionalPropertiesWithComposedSchema = true; ImmutableMap.Builder frameworkBuilder = new ImmutableMap.Builder<>(); for (FrameworkStrategy frameworkStrategy : frameworkStrategies) { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Cat.md index 0af324e1b9e0..aa1ac17604eb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Cat.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Dog.md index b80771ade178..3aa00144e9aa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/Dog.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ParentPet.md index 381c00fd61fa..0e18ba6d591d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/ParentPet.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs index 47cfdf57dda6..1c6fa0f4220b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Cat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : IEquatable, IValidatableObject + public partial class Cat : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,9 +46,9 @@ protected Cat() /// Initializes a new instance of the class. /// /// declawed. - /// className (required). + /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = default(string), string color = "red") + public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); @@ -74,6 +74,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); @@ -84,7 +85,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -117,7 +118,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); @@ -142,6 +143,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs index 01115d4b13c1..8c2d77ca45d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : IEquatable, IValidatableObject + public partial class ChildCat : ParentPet, IEquatable, IValidatableObject { /// /// Defines PetType @@ -66,7 +66,7 @@ protected ChildCat() /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() { this.PetType = petType; this.Name = name; @@ -93,6 +93,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -104,7 +105,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -137,7 +138,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); @@ -164,6 +165,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs index 2ea30a5fd5e6..1ff9ab1624dc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Dog.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : IEquatable, IValidatableObject + public partial class Dog : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,9 +46,9 @@ protected Dog() /// Initializes a new instance of the class. /// /// breed. - /// className (required). + /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = default(string), string color = "red") + public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); @@ -74,6 +74,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); @@ -84,7 +85,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -117,7 +118,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); if (this.AdditionalProperties != null) @@ -143,6 +144,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs index f2b2f671bbea..a205b59b6d09 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,7 +33,7 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : IEquatable, IValidatableObject + public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,8 +46,8 @@ protected ParentPet() /// /// Initializes a new instance of the class. /// - /// petType (required). - public ParentPet(string petType = default(string)) + /// petType (required) (default to "ParentPet"). + public ParentPet(string petType = "ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } @@ -66,6 +66,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -75,7 +76,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -108,7 +109,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; @@ -132,6 +133,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Cat.md index 0af324e1b9e0..aa1ac17604eb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Cat.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Dog.md index b80771ade178..3aa00144e9aa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/Dog.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ParentPet.md index 381c00fd61fa..0e18ba6d591d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/ParentPet.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs index 47cfdf57dda6..1c6fa0f4220b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Cat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : IEquatable, IValidatableObject + public partial class Cat : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,9 +46,9 @@ protected Cat() /// Initializes a new instance of the class. /// /// declawed. - /// className (required). + /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = default(string), string color = "red") + public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); @@ -74,6 +74,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); @@ -84,7 +85,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -117,7 +118,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); @@ -142,6 +143,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs index 01115d4b13c1..8c2d77ca45d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : IEquatable, IValidatableObject + public partial class ChildCat : ParentPet, IEquatable, IValidatableObject { /// /// Defines PetType @@ -66,7 +66,7 @@ protected ChildCat() /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() { this.PetType = petType; this.Name = name; @@ -93,6 +93,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -104,7 +105,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -137,7 +138,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); @@ -164,6 +165,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs index 2ea30a5fd5e6..1ff9ab1624dc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Dog.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : IEquatable, IValidatableObject + public partial class Dog : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,9 +46,9 @@ protected Dog() /// Initializes a new instance of the class. /// /// breed. - /// className (required). + /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = default(string), string color = "red") + public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); @@ -74,6 +74,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); @@ -84,7 +85,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -117,7 +118,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); if (this.AdditionalProperties != null) @@ -143,6 +144,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs index f2b2f671bbea..a205b59b6d09 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,7 +33,7 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : IEquatable, IValidatableObject + public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,8 +46,8 @@ protected ParentPet() /// /// Initializes a new instance of the class. /// - /// petType (required). - public ParentPet(string petType = default(string)) + /// petType (required) (default to "ParentPet"). + public ParentPet(string petType = "ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } @@ -66,6 +66,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -75,7 +76,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -108,7 +109,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; @@ -132,6 +133,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Cat.md index 0af324e1b9e0..aa1ac17604eb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Cat.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Dog.md index b80771ade178..3aa00144e9aa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/Dog.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ParentPet.md index 381c00fd61fa..0e18ba6d591d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/ParentPet.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs index 47cfdf57dda6..1c6fa0f4220b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Cat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : IEquatable, IValidatableObject + public partial class Cat : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,9 +46,9 @@ protected Cat() /// Initializes a new instance of the class. /// /// declawed. - /// className (required). + /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = default(string), string color = "red") + public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); @@ -74,6 +74,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); @@ -84,7 +85,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -117,7 +118,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); @@ -142,6 +143,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs index 01115d4b13c1..8c2d77ca45d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : IEquatable, IValidatableObject + public partial class ChildCat : ParentPet, IEquatable, IValidatableObject { /// /// Defines PetType @@ -66,7 +66,7 @@ protected ChildCat() /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() { this.PetType = petType; this.Name = name; @@ -93,6 +93,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -104,7 +105,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -137,7 +138,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); @@ -164,6 +165,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs index 2ea30a5fd5e6..1ff9ab1624dc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Dog.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : IEquatable, IValidatableObject + public partial class Dog : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,9 +46,9 @@ protected Dog() /// Initializes a new instance of the class. /// /// breed. - /// className (required). + /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = default(string), string color = "red") + public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); @@ -74,6 +74,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); @@ -84,7 +85,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -117,7 +118,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); if (this.AdditionalProperties != null) @@ -143,6 +144,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs index f2b2f671bbea..a205b59b6d09 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,7 +33,7 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : IEquatable, IValidatableObject + public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,8 +46,8 @@ protected ParentPet() /// /// Initializes a new instance of the class. /// - /// petType (required). - public ParentPet(string petType = default(string)) + /// petType (required) (default to "ParentPet"). + public ParentPet(string petType = "ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } @@ -66,6 +66,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -75,7 +76,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -108,7 +109,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; @@ -132,6 +133,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Cat.md index 0af324e1b9e0..aa1ac17604eb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Cat.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Dog.md index b80771ade178..3aa00144e9aa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/Dog.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ParentPet.md index 381c00fd61fa..0e18ba6d591d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/ParentPet.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs index 47cfdf57dda6..1c6fa0f4220b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : IEquatable, IValidatableObject + public partial class Cat : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,9 +46,9 @@ protected Cat() /// Initializes a new instance of the class. /// /// declawed. - /// className (required). + /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = default(string), string color = "red") + public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; this.AdditionalProperties = new Dictionary(); @@ -74,6 +74,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); @@ -84,7 +85,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -117,7 +118,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); @@ -142,6 +143,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs index 01115d4b13c1..8c2d77ca45d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : IEquatable, IValidatableObject + public partial class ChildCat : ParentPet, IEquatable, IValidatableObject { /// /// Defines PetType @@ -66,7 +66,7 @@ protected ChildCat() /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() { this.PetType = petType; this.Name = name; @@ -93,6 +93,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -104,7 +105,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -137,7 +138,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); @@ -164,6 +165,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs index 2ea30a5fd5e6..1ff9ab1624dc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : IEquatable, IValidatableObject + public partial class Dog : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,9 +46,9 @@ protected Dog() /// Initializes a new instance of the class. /// /// breed. - /// className (required). + /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = default(string), string color = "red") + public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; this.AdditionalProperties = new Dictionary(); @@ -74,6 +74,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); @@ -84,7 +85,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -117,7 +118,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); if (this.AdditionalProperties != null) @@ -143,6 +144,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs index f2b2f671bbea..a205b59b6d09 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,7 +33,7 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : IEquatable, IValidatableObject + public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -46,8 +46,8 @@ protected ParentPet() /// /// Initializes a new instance of the class. /// - /// petType (required). - public ParentPet(string petType = default(string)) + /// petType (required) (default to "ParentPet"). + public ParentPet(string petType = "ParentPet") : base(petType) { this.AdditionalProperties = new Dictionary(); } @@ -66,6 +66,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -75,7 +76,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -108,7 +109,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.AdditionalProperties != null) hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode(); return hashCode; @@ -132,6 +133,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Cat.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Cat.md index 0af324e1b9e0..aa1ac17604eb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Cat.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Cat.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Dog.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Dog.md index b80771ade178..3aa00144e9aa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Dog.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/Dog.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ParentPet.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ParentPet.md index 381c00fd61fa..0e18ba6d591d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ParentPet.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/ParentPet.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs index d726c67802e9..e06a1195ef25 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Cat")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Cat : IEquatable, IValidatableObject + public partial class Cat : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -43,9 +43,9 @@ protected Cat() { } /// Initializes a new instance of the class. /// /// declawed. - /// className (required). + /// className (required) (default to "Cat"). /// color (default to "red"). - public Cat(bool declawed = default(bool), string className = default(string), string color = "red") + public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) { this.Declawed = declawed; } @@ -64,6 +64,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -73,7 +74,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -106,7 +107,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); hashCode = hashCode * 59 + this.Declawed.GetHashCode(); return hashCode; } @@ -129,6 +130,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ChildCat.cs index 4b2cb633ce5b..8070a78eddb0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "ChildCat")] [JsonConverter(typeof(JsonSubtypes), "PetType")] - public partial class ChildCat : IEquatable, IValidatableObject + public partial class ChildCat : ParentPet, IEquatable, IValidatableObject { /// /// Defines PetType @@ -63,7 +63,7 @@ protected ChildCat() { } /// /// name. /// petType (required) (default to PetTypeEnum.ChildCat). - public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) + public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() { this.PetType = petType; this.Name = name; @@ -83,6 +83,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PetType: ").Append(PetType).Append("\n"); sb.Append("}\n"); @@ -93,7 +94,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -126,7 +127,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Name != null) hashCode = hashCode * 59 + this.Name.GetHashCode(); hashCode = hashCode * 59 + this.PetType.GetHashCode(); @@ -151,6 +152,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs index d2cca8c3c458..ec5e3c5f9f20 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs @@ -32,7 +32,7 @@ namespace Org.OpenAPITools.Model /// [DataContract(Name = "Dog")] [JsonConverter(typeof(JsonSubtypes), "ClassName")] - public partial class Dog : IEquatable, IValidatableObject + public partial class Dog : Animal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -43,9 +43,9 @@ protected Dog() { } /// Initializes a new instance of the class. /// /// breed. - /// className (required). + /// className (required) (default to "Dog"). /// color (default to "red"). - public Dog(string breed = default(string), string className = default(string), string color = "red") + public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) { this.Breed = breed; } @@ -64,6 +64,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -73,7 +74,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -106,7 +107,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); if (this.Breed != null) hashCode = hashCode * 59 + this.Breed.GetHashCode(); return hashCode; @@ -130,6 +131,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs index 311d390a9931..26e9275891d0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/ParentPet.cs @@ -33,7 +33,7 @@ namespace Org.OpenAPITools.Model [DataContract(Name = "ParentPet")] [JsonConverter(typeof(JsonSubtypes), "PetType")] [JsonSubtypes.KnownSubType(typeof(ChildCat), "ChildCat")] - public partial class ParentPet : IEquatable, IValidatableObject + public partial class ParentPet : GrandparentAnimal, IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -43,8 +43,8 @@ protected ParentPet() { } /// /// Initializes a new instance of the class. /// - /// petType (required). - public ParentPet(string petType = default(string)) + /// petType (required) (default to "ParentPet"). + public ParentPet(string petType = "ParentPet") : base(petType) { } @@ -56,6 +56,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -64,7 +65,7 @@ public override string ToString() /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public virtual string ToJson() + public override string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } @@ -97,7 +98,7 @@ public override int GetHashCode() { unchecked // Overflow is fine, just wrap { - int hashCode = 41; + int hashCode = base.GetHashCode(); return hashCode; } } @@ -119,6 +120,7 @@ public override int GetHashCode() /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { + foreach(var x in BaseValidate(validationContext)) yield return x; yield break; } } From af994a3f3905503bc7362e2b5998daa311352406 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Sun, 21 Mar 2021 18:33:33 -0700 Subject: [PATCH 6/6] Refactors the update in setAddProps to not impact the charp client --- .../openapitools/codegen/DefaultCodegen.java | 40 ++++++------ .../languages/CSharpNetCoreClientCodegen.java | 3 - .../petstore/go/go-petstore/model_cat.go | 64 +++++++++++++++++++ .../petstore/go/go-petstore/model_dog.go | 64 +++++++++++++++++++ 4 files changed, 150 insertions(+), 21 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index f18c10fd4ca8..492539bbf89d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -2615,42 +2615,47 @@ public int compare(CodegenProperty one, CodegenProperty another) { } private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){ -// if (schema.equals(new Schema())) { -// // if we are trying to set additionalProperties on an empty schema stop recursing -// return; -// } -// if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) { -// return; -// } + if (schema.equals(new Schema())) { + // if we are trying to set additionalProperties on an empty schema stop recursing + return; + } + boolean additionalPropertiesIsAnyType = false; CodegenModel m = null; if (property instanceof CodegenModel) { m = (CodegenModel) property; } + CodegenProperty addPropProp = null; boolean isAdditionalPropertiesTrue = false; if (schema.getAdditionalProperties() == null) { if (!disallowAdditionalPropertiesIfNotPresent) { isAdditionalPropertiesTrue = true; - CodegenProperty cp = fromProperty("", new Schema()); - property.setAdditionalProperties(cp); - property.setAdditionalPropertiesIsAnyType(true); + addPropProp = fromProperty("", new Schema()); + additionalPropertiesIsAnyType = true; } } else if (schema.getAdditionalProperties() instanceof Boolean) { if (Boolean.TRUE.equals(schema.getAdditionalProperties())) { isAdditionalPropertiesTrue = true; - CodegenProperty cp = fromProperty("", new Schema()); - property.setAdditionalProperties(cp); - property.setAdditionalPropertiesIsAnyType(true); + addPropProp = fromProperty("", new Schema()); + additionalPropertiesIsAnyType = true; } } else { - CodegenProperty cp = fromProperty("", (Schema) schema.getAdditionalProperties()); - property.setAdditionalProperties(cp); + addPropProp = fromProperty("", (Schema) schema.getAdditionalProperties()); if (isAnyTypeSchema((Schema) schema.getAdditionalProperties())) { - property.setAdditionalPropertiesIsAnyType(true); + additionalPropertiesIsAnyType = true; } } + if (additionalPropertiesIsAnyType) { + property.setAdditionalPropertiesIsAnyType(true); + } if (m != null && isAdditionalPropertiesTrue) { m.isAdditionalPropertiesTrue = true; } + if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) { + return; + } + if (addPropProp != null) { + property.setAdditionalProperties(addPropProp); + } } @@ -6164,11 +6169,10 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S } private void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property){ + setAddProps(schema, property); if (!"object".equals(schema.getType())) { return; } - // todo move this higher than the object check - setAddProps(schema, property); if (schema instanceof ObjectSchema) { ObjectSchema objSchema = (ObjectSchema) schema; HashSet requiredVars = new HashSet<>(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java index 01d5d564ddc9..87a6ae3faa7f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java @@ -215,9 +215,6 @@ public CSharpNetCoreClientCodegen() { disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts); cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt); this.setDisallowAdditionalPropertiesIfNotPresent(true); - // this generator supports additional properties in composed schemas - // TODO turn this on? - // supportsAdditionalPropertiesWithComposedSchema = true; ImmutableMap.Builder frameworkBuilder = new ImmutableMap.Builder<>(); for (FrameworkStrategy frameworkStrategy : frameworkStrategies) { diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_cat.go b/samples/openapi3/client/petstore/go/go-petstore/model_cat.go index 88ebf1b620a3..972484d4dbdd 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/model_cat.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_cat.go @@ -12,14 +12,19 @@ package petstore import ( "encoding/json" + "reflect" + "strings" ) // Cat struct for Cat type Cat struct { Animal Declawed *bool `json:"declawed,omitempty"` + AdditionalProperties map[string]interface{} } +type _Cat Cat + // NewCat instantiates a new Cat object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -85,9 +90,68 @@ func (o Cat) MarshalJSON() ([]byte, error) { if o.Declawed != nil { toSerialize["declawed"] = o.Declawed } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) } +func (o *Cat) UnmarshalJSON(bytes []byte) (err error) { + type CatWithoutEmbeddedStruct struct { + Declawed *bool `json:"declawed,omitempty"` + } + + varCatWithoutEmbeddedStruct := CatWithoutEmbeddedStruct{} + + err = json.Unmarshal(bytes, &varCatWithoutEmbeddedStruct) + if err == nil { + varCat := _Cat{} + varCat.Declawed = varCatWithoutEmbeddedStruct.Declawed + *o = Cat(varCat) + } else { + return err + } + + varCat := _Cat{} + + err = json.Unmarshal(bytes, &varCat) + if err == nil { + o.Animal = varCat.Animal + } else { + return err + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "declawed") + + // remove fields from embedded structs + reflectAnimal := reflect.ValueOf(o.Animal) + for i := 0; i < reflectAnimal.Type().NumField(); i++ { + t := reflectAnimal.Type().Field(i) + + if jsonTag := t.Tag.Get("json"); jsonTag != "" { + fieldName := "" + if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 { + fieldName = jsonTag[:commaIdx] + } else { + fieldName = jsonTag + } + if fieldName != "AdditionalProperties" { + delete(additionalProperties, fieldName) + } + } + } + + o.AdditionalProperties = additionalProperties + } + + return err +} + type NullableCat struct { value *Cat isSet bool diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_dog.go b/samples/openapi3/client/petstore/go/go-petstore/model_dog.go index e920fc4a987a..0da4e82a2635 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/model_dog.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_dog.go @@ -12,14 +12,19 @@ package petstore import ( "encoding/json" + "reflect" + "strings" ) // Dog struct for Dog type Dog struct { Animal Breed *string `json:"breed,omitempty"` + AdditionalProperties map[string]interface{} } +type _Dog Dog + // NewDog instantiates a new Dog object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -85,9 +90,68 @@ func (o Dog) MarshalJSON() ([]byte, error) { if o.Breed != nil { toSerialize["breed"] = o.Breed } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) } +func (o *Dog) UnmarshalJSON(bytes []byte) (err error) { + type DogWithoutEmbeddedStruct struct { + Breed *string `json:"breed,omitempty"` + } + + varDogWithoutEmbeddedStruct := DogWithoutEmbeddedStruct{} + + err = json.Unmarshal(bytes, &varDogWithoutEmbeddedStruct) + if err == nil { + varDog := _Dog{} + varDog.Breed = varDogWithoutEmbeddedStruct.Breed + *o = Dog(varDog) + } else { + return err + } + + varDog := _Dog{} + + err = json.Unmarshal(bytes, &varDog) + if err == nil { + o.Animal = varDog.Animal + } else { + return err + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "breed") + + // remove fields from embedded structs + reflectAnimal := reflect.ValueOf(o.Animal) + for i := 0; i < reflectAnimal.Type().NumField(); i++ { + t := reflectAnimal.Type().Field(i) + + if jsonTag := t.Tag.Get("json"); jsonTag != "" { + fieldName := "" + if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 { + fieldName = jsonTag[:commaIdx] + } else { + fieldName = jsonTag + } + if fieldName != "AdditionalProperties" { + delete(additionalProperties, fieldName) + } + } + } + + o.AdditionalProperties = additionalProperties + } + + return err +} + type NullableDog struct { value *Dog isSet bool