Is there a way to do the same
var item = new Item(request.payload);
item.tags = _.map(item.tags, function(s){
return s.trim().toLowerCase();
});
in the validation code ?
var Joi = require('joi'),
Tags = Joi.array().min(1).max(3).unique().required();
exports.create = {
payload: {
tags: Tags
}
};
此验证架构应工作:
Joi.array().items(Joi.string().trim().lowercase()).unique().min(1).max(3).required();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.