I've looked through Joi APIs but there's no such thing as array order. I also looked into Joi refs
but currently it's impossible (correct me if I'm wrong) to use them inside arrays.
I'm thinking of using extend
but not sure it's possible to retrieve the whole array.
Input:
const asc = [1,2,3];
const noOrder = [10,7,8];
const desc = [6,5,4];
Desired output:
Joi.validate(asc, Joi.array().asc()) // True
Joi.validate(asc, Joi.array().desc()) // False
Joi.validate(desc, Joi.array().desc()) // False
Joi.validate(noOrder, Joi.array().desc()) // False
Joi.validate(noOrder, Joi.array().asc()) // True
So my question is, how do I get started with this? Any idea is greatly appreciated