-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from AustinMusiku/fix-unable-to-merge-schema
Fix: Fixed allow override schema field types
- Loading branch information
Showing
1 changed file
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader' | ||
import { loadSchemaSync } from '@graphql-tools/load' | ||
import { addResolversToSchema } from '@graphql-tools/schema' | ||
import { readFileSync } from 'fs' | ||
import { join } from 'path' | ||
import { createSchema } from 'graphql-yoga' | ||
import resolvers from '../resolvers' | ||
|
||
// Load typedefs from the file | ||
const schema = loadSchemaSync('**/*.graphql', { | ||
loaders: [new GraphQLFileLoader()] | ||
const schema = createSchema({ | ||
typeDefs: readFileSync( | ||
join(__dirname, '../typedefs/index.graphql'), | ||
'utf8' | ||
), | ||
resolvers | ||
}) | ||
|
||
// Add resolvers to the schema | ||
const schemaWithResolvers = addResolversToSchema({ schema, resolvers }) | ||
|
||
export default schemaWithResolvers | ||
export default schema |