My current validation process involves using fastest-validator. Here is an example of the object being validated:
{
"_id":"619e00c177f6ea2eccffd09f",
"parent_id": "619e00c177f6ea2eccffd09f",
}
I need to ensure that _id
and parent_id
are not equal. How can I perform this check using fastest-validator
? The library provides a method for validating equality, but I require the opposite behavior.
const schema = {
password: { type: "string", min: 6 },
confirmPassword: { type: "equal", field: "password" }
}
const check = v.compile(schema);
check({ password: "123456", confirmPassword: "123456" }); // Valid
check({ password: "123456", confirmPassword: "pass1234" }); // Fail
Any suggestions or insights regarding this matter would be greatly appreciated. Thank you in advance!