我有快速运行GraphQL的服务器。
有一个Foo类型的模式
FooType = new GraphQLObjectType({
name: 'Foo',
fields: () => ({
name: {
type: GraphQLString,
},
surname: {
type: GraphQLString,
},
}),
});
schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
foo: {
type: FooType,
resolve: () => fooResolver
}
}
})
})
foo
的解析器返回对象{ name: 'bar', surname: 'boo' }
,但是作为graphQL服务器的响应,我得到了一个对象{ name: 'bar', surname: null }
问题是 -