0

按照https://fabric-composer.github.io/start/getting-started-rest-api.html的说明,测试生成的 api

curl -X GET --header "Accept: application/json" "http://0.0.0.0:3000/api/net.biz.digitalPropertyNetwork.LandTitle"

生成以下错误

 {
  "error": {
    "statusCode": 500,
    "name": "Error",
    "message": "No registered namespace for type net_biz_digitalPropertyNetwork_LandTitle",
    "stack": "Error: No registered namespace for type net_biz_digitalPropertyNetwork_LandTitle\n    at ModelManager.getType (/Users/matt/Documents/workspaces/blockchain/src/github.com/fabric-composer/sample-applications/node_modules/composer-common/lib/modelmanager.js:265:23)\n    at ensureConnected.then (/Users/matt/Documents/workspaces/blockchain/src/github.com/fabric-composer/sample-applications/node_modules/composer-loopback-connector/lib/businessnetworkconnector.js:198:53)\n    at process._tickDomainCallback (internal/process/next_tick.js:129:7)"
  }
}

我看到引导脚本将点换成下划线,这可能在其他地方也需要吗?

// this is required because LoopBack doesn't like dots in model schema names
    modelSchema.name = modelSchema.plural.replace(/\./g, '_');

供参考,这是我的环回包的节点依赖项

"dependencies": {
    "composer-loopback-connector": "^0.4.0",
    "compression": "^1.0.3",
    "cors": "^2.5.2",
    "helmet": "^1.3.0",
    "loopback": "^2.22.0",
    "loopback-boot": "^2.6.5",
    "loopback-component-explorer": "^2.4.0",
    "loopback-connector-composer": "^0.4.1",
    "loopback-datasource-juggler": "^2.39.0",
    "serve-favicon": "^2.0.1",
    "strong-error-handler": "^1.0.1"
  }
4

1 回答 1

1

是的,你是对的,引导脚本将点换成下划线。这是由于环回不接受模型名称中的点,因此引导脚本将它们换出,并且连接器在被环回应用程序调用时会考虑到这一点。

这是 npm as 中的原始连接器的问题composer-connector-loopback。该版本尚未删除,但应该很快就会删除。

它已被重命名以使其与其他环回连接器保持一致,并且也在 npm 中作为loopback-connector-composer.

我将提出一个问题以更新您提到的入门指南,如果您可以切换到使用其他连接器,那么应​​该可以解决问题。HTH。

于 2017-02-08T12:04:32.707 回答