简体   繁体   English

是否可以在ArangoDB Foxx中扩展Joi模式?

[英]Is it possible to extend Joi schema in ArangoDB Foxx?

I have made an extension of a Joi type and successfully tested it on a test Node.js application. 我做了一个Joi类型的扩展,并在测试Node.js应用程序上成功地对其进行了测试。 I am trying now to incorporate this extension in Foxx, since it supports Joi, but it doesn't seem to work: calling "Joi.extend(extension)", which works in the test application fails in Foxx. 我现在正在尝试将此扩展合并到Foxx中,因为它支持Joi,但似乎不起作用:在测试应用程序中运行的“ Joi.extend(extension)”调用在Foxx中失败。

Is there a difference in the versions of Joi on NPM and Joi in Foxx? NPM上的Joi版本和Foxx中的Joi版本是否有所不同? Is it actually possible to make extensions in the Foxx version of Joi? 实际上有可能在Joi的Foxx版本中进行扩展吗?

ArangoDB uses joi in version 9.2.0 (see github ). ArangoDB在9.2.0版中使用joi(请参阅github )。 Since this version already supports extend(extension) your extension should work. 由于此版本已支持extend(extension)您的扩展应该可以使用。 Keep in mind that extend returns a new joi instance rather than modifying the existing one. 请记住, extend返回一个新的joi实例,而不是修改现有的joi实例。

You can use a different version of joi within your Foxx service by including it in the node_modules folder of your bundle. 您可以在Foxx服务中使用不同版本的node_modules ,方法是将其包含在包的node_modules文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM