From 44c0d48887863797785e8b8915802e27b8d7b1cb Mon Sep 17 00:00:00 2001 From: Austin Musiku <47279609+MusikuAustin@users.noreply.github.com> Date: Wed, 20 Sep 2023 21:55:06 +0300 Subject: [PATCH] Fix: Fixed allow override schema field types --- src/schema/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/schema/index.ts b/src/schema/index.ts index 814bd33..b470d95 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -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