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; } } }