Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Jawell
Copy link

@Jawell Jawell commented Jan 21, 2025

Hi there! I want to add one more validator if you don't mind

@Jawell
Copy link
Author

Jawell commented Jan 23, 2025

@Keats ping :)

@@ -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
Copy link
Owner

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?

Copy link
Author

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 {
Copy link
Owner

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, should be PartialEq

@Jawell Jawell force-pushed the add-must-not-match-validator branch from 1dc4cb8 to 4d3607a Compare February 5, 2025 09:10
@Keats
Copy link
Owner

Keats commented Feb 9, 2025

Looks like legit failures

@Jawell
Copy link
Author

Jawell commented Feb 9, 2025

Looks like legit failures

I fixed tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants