在我用.unique
向order schema
添加platform_order_id
到这里之后是错误:
AssertionError: Invalid schema content: (platform_order_id)
这里是function validateOrder
:
function validateOrder(order) {
const schema = {
customer_name: Joi.string()
.required(),
amount_rmb: Joi.number()
.precision(2)
.required(),
amount_crypto: Joi.number()
.precision(2)
.required(),
platform_order_id: Joi.number()
.required()
.unique, //<== causing error
x_rate: Joi.number()
.required()
};
return Joi.validate(order, schema);
};
order.platform_order_id
是149345
。尝试过Number('149345')
并且错误是相同的。如果没有.unique
,则验证工作正常。我在这里想念什么?