【发布时间】:2022-01-11 23:02:01
【问题描述】:
我正在使用 Hasura 为 PostgreSQL 表提供 GraphQL 接口。如果我有一个带有integer[] 列的表,则命令apollo schema:download 将生成一个schema.json,其中包含:
{
"name": "distances",
"description": null,
"type": {
"kind": "SCALAR",
"name": "_int4",
"ofType": null
},
"defaultValue": null
}
这是不幸的,因为它没有传达这个字段是一个数组的信息。自然,当我使用 apollo codegen:generate 时,类型要么变形为 String,要么只是 _int4,如果使用 --passthroughCustomScalars 标志。
有没有办法配置我的 graphql 服务器 (Hasura) 或 apollo CLI 以保留数组类型信息?
【问题讨论】: