graphql - GraphQL 中继节点接口
问题描述
我正在尝试合并 2 个实现自己的 nodeDefinitions 的模式。一种模式使用 globalId,如下所示:
const UserType = new GraphQLObjectType({
name: 'User',
interfaces: () => [nodeInterface],
fields: () => ({
id: globalIdField('User'),
...
而另一个schema实现了这种节点接口,有自己的自定义id
const Node = new GraphQLInterfaceType({
name: 'Node',
description: 'Generic Node to fetch single parts of the graph.',
fields: {
id: { type: new GraphQLNonNull(entries.types.ariseId) }
},
错误
{
"errors": [
{
"message": "Interface field Node.id expects type ID! but Property.id
is type ariseId!.\n\nInterface field Node.id expects type ID! but
SpaceType.id is type ariseId!.\n\nInterface field Node.id expects
type ID! but Availability.id is type ariseId!.\n\nInterface field
Node.id expects type ID! but RatePlan.id is type
ariseId!.\n\nInterface field Node.id expects type ID! but
Traveler.id is type ariseId!.\n\nInterface field Node.id expects
type ID! but Partner.id is type ariseId!.\n\nInterface field
Node.id expects type ID! but Reservation.id is type ariseId!."
}
]
}
解决方案
推荐阅读
- javascript - 从 json 的数据中返回一个新数组
- javascript - 何时以及为何在 HTML 头部部分使用 javascript 代码?
- php - 使用 PHP CS Fixer 删除导入之间的多余行
- system-verilog - VCS 工具在 edaplayground 上使用 uvm_hdl_deposit 时出错
- c++ - C++ 中的复杂性分析
- html - 如何修复 flexbox 偏移项目
- ios - SwiftUI 多轮选择器触摸边界偏移和崩溃 iOS 15
- vue.js - 我可以设置 503 页面的样式吗?
- node.js - node js上传图片并上传到ftp:适用于一张但不是两张图片
- angular - 使用特定模块时 ag-grid-enterprise 类型的位置?