Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js graphql合并GraphQLObjectType模式中的模式_Node.js_Graphql_Apollo_Graphql Tools - Fatal编程技术网

Node.js graphql合并GraphQLObjectType模式中的模式

Node.js graphql合并GraphQLObjectType模式中的模式,node.js,graphql,apollo,graphql-tools,Node.js,Graphql,Apollo,Graphql Tools,我是graphql新手,所以我面临一些问题。 服务器基于nodeJS和express包。我正在用GraphQLObjectType表示法为Apollo Graphql编写模式。 当我想将两个模式合并为一个模式时,我使用graphql tools npm包中的mergeSchemas方法,并在合并时遇到一些错误。有人能告诉我我在做什么吗 const { mergeSchemas } = require('graphql-tools'); const { GraphQLSchema } = requ

我是graphql新手,所以我面临一些问题。 服务器基于nodeJS和express包。我正在用GraphQLObjectType表示法为Apollo Graphql编写模式。 当我想将两个模式合并为一个模式时,我使用graphql tools npm包中的mergeSchemas方法,并在合并时遇到一些错误。有人能告诉我我在做什么吗

const { mergeSchemas } = require('graphql-tools');
const { GraphQLSchema } = require('graphql');

const queryType = require('./queryType');
const eventMutations = require('./eventMutations');
const userMutations = require('./userMutations');

const mutationType = mergeSchemas({
  schemas: [eventMutations, userMutations],
});

module.exports = new GraphQLSchema({
  query: queryType,
  mutation: mutationType,
});
每个EventRatings、UserRatings都是GraphQLObjectType

错误是:

Invalid schema passed


有什么想法吗?

问题是我想合并GraphQLObjectType,但不是真正的GraphQLSchema。 因此,解决方案是为用户和事件创建GraphQLSchema,然后将它们完美地合并在一起

mergeSchemas({...