将 Loopback 迁移到 Loopback 4 时出现 S2O 错误

S2OError while migrating Loopback3 to Loopback4

我们必须将几个 node.js 应用程序从 Loopback3 迁移到 Loopback4。 所以我们要做的第一步是按照指南(1 and 2)进行基本迁移,然后通过手动升级方法和逻辑完成它,并彻底删除 lb3 应用程序。
不幸的是,在指南中的迁移步骤结束时,当尝试启动应用程序时 (node -r source-map-support/register .),我们收到以下错误:

...
Swagger: skipping unknown type "Document".
Cannot start the application. { S2OError: Could not resolve reference #/definitions/Document
...

如有任何帮助,我们将不胜感激。

好的, 在回答这个问题的同时,我还在 github 上打开了一个 issue on loopback-next 仓库。 所以这个问题已经在那个线程上解决了。

这里是解决方案:

I've temporarily changed this return type to Object, and it runs successfully and migration goes fine. So I've solved in this way as my scope is to rewrite this specific method. Anyway I have to say the lb3 application runs fine, even though this type is not defined in it.

希望这对某人有所帮助。