You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to make sure, that the numeric value of an object property is not lesser than another numeric object property under a different parent key. I tried to use object.assert for this, but i did not get the expected results.
node version: 4.4.7
joi version: 9.2.0
environment: node
constJoi=require('joi');constschema=Joi.object().keys({a: Joi.object().keys({b: Joi.number()}),c: Joi.object().keys({d: Joi.number()})}).assert('a.b',Joi.number().min(Joi.ref('c.d')),'"a.b" cannot be less than "c.d"');constresults=Joi.validate({a: {b: 2},c: {d: 1}},schema);console.log(results);
Although a.b is greater than c.d, i get a validation error.
What am i doing wrong?
The text was updated successfully, but these errors were encountered:
Trying to figure out where state is getting dropped, but this goes several levels deeper than I've gone before and I wanted to share findings here in case something clicked for someone else faster.
I'm trying to make sure, that the numeric value of an object property is not lesser than another numeric object property under a different parent key. I tried to use object.assert for this, but i did not get the expected results.
Although
a.b
is greater thanc.d
, i get a validation error.What am i doing wrong?
The text was updated successfully, but these errors were encountered: