skwasjer / IbanNet

C# .NET IBAN validator, parser, builder and generator
Apache License 2.0
119 stars 31 forks source link

Spaces in a properly formatted IBAN will result in a validation error #142

Closed FunnyPaul closed 1 year ago

FunnyPaul commented 1 year ago

In the 5.3.1 version used in the MVC example (which can be downloaded here), a formatted, valid IBAN is also validated as such.

However, not in the current version 5.9.0, only if the spaces have been removed. Of course, that makes handling more difficult, since I have to replace the spaces in the model, validate them again, then put the formatted string in again, etc.

Is there an option that formatted IBANs that are correct can also be validated without errors?

skwasjer commented 1 year ago

This was changed in v5.7.0

Both the data annotations and fluent validation implementations now have a strict parameter (default true), with which you can allow more relaxed validation (whitespace, casing). I will update the wiki when I have some time.

And here is the related discussion: https://github.com/skwasjer/IbanNet/issues/93 and PR https://github.com/skwasjer/IbanNet/pull/95

FunnyPaul commented 1 year ago

Many thanks for the quick and competent answer. Then it's not a bug :-)

skwasjer commented 10 months ago

AspNetCoreExample updated with non-strict in #159.