带有休息客户端的 Gentics Mesh 中的无效 graphql 请求

Invalid graphql request in Gentics Mesh with rest client

我在使用 MeshRestClient 执行图形查询时遇到错误 -

{
  "errors": [
    {
      "message": "Validation error of type InvalidFragmentType: Fragment cannot be spread here as objects of type Node can never be of type teaching @ 'node/children/elements'",
      "type": "ValidationError",
      "locations": [
        {
          "line": 1,
          "column": 288
        }
      ]
    },
    {
      "message": "Validation error of type FieldUndefined: Field 'fields' in type 'teaching' is undefined @ 'node/children/elements/fields'",
      "type": "ValidationError",
      "locations": [
        {
          "line": 1,
          "column": 315
        }
      ]
    }
  ]
}

尽管相同的请求在 Postman 中工作正常。

更新: 我发现客户端在使用客户端时正在对/api/v1执行请求。
如果我 post 在 Postman 中对 /api/v1 进行相同的查询,我可以重现该错误。

我想如果我可以强制其他客户端使用 /api/v2,它应该可以工作..

您可以通过在创建客户端时设置基本路径来将 /api/v2MeshRestClient 一起使用:

MeshRestClient.create(MeshRestClientConfig.newConfig()
    .setHost("demo.getmesh.io")
    .setPort(80)
    .setSsl(true)
    .setBasePath("/api/v2")
    .build());