2

我正在使用最新版本的 Postraphile(在其 Docker 容器上)并且我已经安装了pg-simplify-inflector插件,我注意到操作名称方面的改进,我希望获得操作及其结果的简化格式。例子:

对于此操作:

query MyQuery {
  iddocTypes {
    nodes {
      id
      name
    }
  }
}

结果:

{
  "data": {
    "iddocTypes": {
      "nodes": [
        {
          "id": 1,
          "name": "some 1"
        },
        {
          "id": 2,
          "name": "some 2"
        },
        {
          "id": 3,
          "name": "some 3"
        }
      ]
    }
  }
}

我希望得到这个:

query MyQuery {
  iddocTypes {
    id
    name
  }
}

结果:

{
  "data": {
    "iddocTypes": [
      {
        "id": 1,
        "name": "some 1"
      },
      {
        "id": 2,
        "name": "some 2"
      },
      {
        "id": 3,
        "name": "some 3"
      }
    ]
  }
}

我在 Postgraphile 中使用这些选项docker-compose.yml

      "--dynamic-json",
      "--subscriptions",
      "--no-setof-functions-contain-nulls",
      "--no-ignore-rbac",
      "--no-ignore-indexes",
      "--show-error-stack", "json",
      "--extended-errors", "hint,detail,errcode",
      "--enable-query-batching",
      "--legacy-relations", "omit",
      "--append-plugins", "@graphile-contrib/pg-simplify-inflector",
      "--enhance-graphiql"

我需要做些什么来简化它?

4

1 回答 1

1

添加此选项:

      "--simple-collections", "only",

资料来源:https ://www.graphile.org/postgraphile/usage-cli/

于 2021-09-22T08:43:23.890 回答