Closed alexrp closed 1 year ago
Specifically:
https://github.com/jstedfast/EmailValidation/blob/643a8e3cf3dd93f5eba60e27639728df8d3457a3/EmailValidation/EmailAttribute.cs#L86-L87
https://github.com/jstedfast/EmailValidation/blob/643a8e3cf3dd93f5eba60e27639728df8d3457a3/EmailValidation/EmailAttribute.cs#L105
Most (all?) attributes in System.ComponentModel.DataAnnotations of a similar nature to EmailAttribute consider null to be valid.
System.ComponentModel.DataAnnotations
EmailAttribute
Examples:
Generally speaking, one should use RequiredAttribute if a value should not be allowed to be null. (Higher-level frameworks like ASP.NET Core will additionally use C# nullability annotations to infer RequiredAttribute.)
RequiredAttribute
(Aside: The allocation of memberNames is pointless in the success case.)
memberNames
Seems reasonable. Hopefully won't break any existing apps due to a change in expectations.
Specifically:
https://github.com/jstedfast/EmailValidation/blob/643a8e3cf3dd93f5eba60e27639728df8d3457a3/EmailValidation/EmailAttribute.cs#L86-L87
https://github.com/jstedfast/EmailValidation/blob/643a8e3cf3dd93f5eba60e27639728df8d3457a3/EmailValidation/EmailAttribute.cs#L105
Most (all?) attributes in
System.ComponentModel.DataAnnotations
of a similar nature toEmailAttribute
consider null to be valid.Examples:
Generally speaking, one should use
RequiredAttribute
if a value should not be allowed to be null. (Higher-level frameworks like ASP.NET Core will additionally use C# nullability annotations to inferRequiredAttribute
.)