Keats / validator

Simple validation for Rust structs
MIT License
1.97k stars 141 forks source link

Fully remove code for old phone validation #253

Closed kyrias closed 1 year ago

kyrias commented 1 year ago

The phone validation code was partially removed in 897811a but parts were left in leading to tests not passing.

This also updates the expected compiler errors for two compile-fail cases. There is one that is still failing, but I haven't had the time to look into it yet.

Keats commented 1 year ago

Need to implement validate_email for Vec it seems for the last test

kyrias commented 1 year ago

Need to implement validate_email for Vec it seems for the last test

Well, the test is supposed to fail due to Vec<u8> not being a string type, it's just that the derive macro no longer checks this due to this: https://github.com/Keats/validator/commit/4830561e0d18ad63c465869b829847e26c317a7c#diff-3eff0f2d5b7cc9529715768d5c9b284c3abe2402e4769ccf6312f75b7f752536

I don't get why this was done.

kyrias commented 1 year ago

Oh right, it's to allow them to be implemented for custom types. It definitely shouldn't be implemented for Vec<u8> but I guess this means that we'll just have to drop this compile fail test since if we allow any type to implement it, we cannot have the derive macro give a nice error for this.