GraphQL operations/results 格式可以简化吗?
Can GraphQL operations/results format be simplified?
我正在使用最新版本的 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"
}
]
}
}
我在 docker-compose.yml
中将这些选项用于 Postgraphile:
"--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"
我需要做什么来简化它?
添加这个选项:
"--simple-collections", "only",
我正在使用最新版本的 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"
}
]
}
}
我在 docker-compose.yml
中将这些选项用于 Postgraphile:
"--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"
我需要做什么来简化它?
添加这个选项:
"--simple-collections", "only",