我在 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 应用程序中使用它会导致应用程序停止工作。将上面的代码段粘贴到 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 版本,该版本已删除此功能?