-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add must_not_match validator #365
base: master
Are you sure you want to change the base?
Conversation
@Keats ping :) |
validator_derive/src/lib.rs
Outdated
@@ -178,6 +179,19 @@ impl ToTokens for ValidateField { | |||
quote!() | |||
}; | |||
|
|||
// Must not match validation | |||
let must_not_match = if let Some(must_not_match) = self.must_not_match.clone() { | |||
// TODO: handle option for other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that still a TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understood correctly - it was handled
/// Validates that the 2 given fields do not match. | ||
/// Both fields are optionals | ||
#[must_use] | ||
pub fn validate_must_not_match<T: Eq>(a: T, b: T) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want Eq or PartialEq?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, should be PartialEq
1dc4cb8
to
4d3607a
Compare
Looks like legit failures |
I fixed tests |
Hi there! I want to add one more validator if you don't mind