We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to define a schema for an object with properties a and b, and I want a and b to be numbers that are not equal to one another.
a
b
const Joi = require("joi"); Joi .object({ a: Joi.number(), b: Joi.number().invalid(Joi.ref("a")) }) .validate({ a: 123, b: 321 });
An error is thrown:
Item cannot come after itself: a
No errors.
This example at RunKit: https://runkit.com/57d675ee7580c314003cf648/59a52dfce0c6b2001608a2f1
The text was updated successfully, but these errors were encountered:
Found the bug, will fix it asap. Can it wait for joi 11 ?
Sorry, something went wrong.
@Marsup Yes.
Can you guys explain the bug/fix? I'm getting the same error here
Good catch, fixed it in 11 and forgot to mention it here.
Marsup
No branches or pull requests
Context
What are you trying to achieve or the steps to reproduce ?
I want to define a schema for an object with properties
a
andb
, and I wanta
andb
to be numbers that are not equal to one another.Which result you had ?
An error is thrown:
What did you expect ?
No errors.
This example at RunKit: https://runkit.com/57d675ee7580c314003cf648/59a52dfce0c6b2001608a2f1
The text was updated successfully, but these errors were encountered: