ardatan / ardatan/graphql-import

Ability to exclude Query, Mutation and Subscription types from imported schema

Open
#205 6 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
864
Forks
53
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the importSchema entry point and inspect how it imports the generated Prisma schema, including its Query, Mutation, and Subscription types. Compare the imported schema with the custom schemas passed to mergeTypes; done means callers can exclude selected root operation types while retaining the generated types and inputs they need.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.