我正在使用graphql-compose
库。我正在使用类型编写器创建类并将其添加到架构编写器中,并构建了架构。
如何向架构编辑器添加(合并)另一个架构?或如何创建可执行架构并添加(合并)架构编辑器构建的架构。
我需要添加的架构来自apollo-upload-server
。其文档声明了这样的架构:
const schema = makeExecutableSchema({
typeDefs: `scalar Upload`,
resolvers: { Upload: GraphQLUpload }
})
答案 0 :(得分:0)
此解决方案适用于我:
import { mergeSchemas } from 'graphql-tools'
import { schemaComposer } from 'graphql-compose'
import {GraphQLUpload} from 'apollo-upload-server'
const composerSchema = schemaComposer.buildSchema()
const uploadSchema = makeExecutableSchema({
typeDefs: `scalar Upload`,
resolvers: { Upload: GraphQLUpload }
})
const graphqlSchema = mergeSchemas({
schemas: [composerSchema, uploadSchema]
})