Skip to content

Commit

Permalink
Set AllowEmptyStrings to true on RequiredAttribute (fixes #200)
Browse files Browse the repository at this point in the history
  • Loading branch information
mganss committed May 17, 2024
1 parent ac85827 commit e835215
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions XmlSchemaClassGenerator/TypeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ public void AddMembersTo(CodeTypeDeclaration typeDeclaration, bool withDataBindi
if (IsRequired && Configuration.DataAnnotationMode != DataAnnotationMode.None)
{
var requiredAttribute = new CodeAttributeDeclaration(CodeUtilities.CreateTypeReference(Attributes.Required, Configuration));
var allowEmptyStringsArgument = new CodeAttributeArgument("AllowEmptyStrings", new CodePrimitiveExpression(true));
requiredAttribute.Arguments.Add(allowEmptyStringsArgument);
member.CustomAttributes.Add(requiredAttribute);
}

Expand Down

0 comments on commit e835215

Please sign in to comment.