From c33a3858b32877478566a3a2b792ff37ad220af9 Mon Sep 17 00:00:00 2001 From: Michael Ganss Date: Fri, 12 Apr 2024 16:17:59 +0200 Subject: [PATCH] Reverse IsRequired interface and class alignment (see #501) --- XmlSchemaClassGenerator/ModelBuilder.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/XmlSchemaClassGenerator/ModelBuilder.cs b/XmlSchemaClassGenerator/ModelBuilder.cs index a72c9dd..5099e38 100644 --- a/XmlSchemaClassGenerator/ModelBuilder.cs +++ b/XmlSchemaClassGenerator/ModelBuilder.cs @@ -237,16 +237,16 @@ private void PromoteInterfacePropertiesToCollection() interfaceProperty.IsCollection = false; } - if (derivedProperties.Exists(p => p.IsRequired)) + if (derivedProperties.Exists(p => !p.IsRequired)) { foreach (var derivedProperty in derivedProperties.Where(p => !p.IsRequired)) - derivedProperty.IsRequired = true; + derivedProperty.IsRequired = false; - interfaceProperty.IsRequired = true; + interfaceProperty.IsRequired = false; } else { - interfaceProperty.IsRequired = false; + interfaceProperty.IsRequired = true; } } }