This feature would be useful when we have types and inputs generated by Prisma, and want to add custom implemented Query and Mutation for real-world app.
For example:
const { importSchema } = require("graphql-import");
const { GraphQLServer } = require('graphql-yoga');
const { mergeTypes } = require("merge-graphql-schemas");
const typeDefs = mergeTypes([
importSchema(`# import * from './src/graphql/generated/prisma.graphql'`),
readFileSync('./src/common/schema.graphqls', {encoding: 'utf-8'}),
readFileSync('./src/auth/schema.graphqls', {encoding: 'utf-8'}),
...
], { all: true });
const server = new GraphQLServer({
typeDefs,
...
});
But now I can't do that because importSchema grabs generated Query and Mutation types directly into application API.