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