【发布时间】:2015-09-02 14:41:57
【问题描述】:
我在 foxx 应用程序中使用 joi 数组项验证以及在 arangodb-2.5.5 中使用 arango-shell 时遇到问题。 joi-documentation 建议使用类似:
var Joi = require('joi');
Joi.array().items({'name': Joi.string().required()});
用于验证类似于以下内容的数据集:
[{'name': 'Peter'}, {'name': 'Edeltraut'}, ...]
但是,在 Foxx 应用程序中使用它会导致应用程序停止工作。将 sn-p 从上面粘贴到 arango-shell 会产生以下输出:
JavaScript exception: TypeError: undefined is not a function
!Joi.array().items({'name': Joi.string().required()});
! ^
stacktrace: TypeError: undefined is not a function
at <shell command>:1:13
是我遗漏了什么,还是 arangodb 使用了修改/更小的 joi 版本,去掉了这个功能?
【问题讨论】: