Skip to content

Commit

Permalink
fix: Fixes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasdao committed Feb 1, 2021
1 parent 1259d47 commit 8017df3
Show file tree
Hide file tree
Showing 5 changed files with 755 additions and 589 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const getAppConfig = () => {
return fs.existsSync(appconfigPath) ? require(appconfigPath) : null
}

const isMissingSchema = gluedSchema => !gluedSchema || (!gluedSchema.schema && gluedSchema.query == 'type Query {' && gluedSchema.mutation == 'type Mutation {' && gluedSchema.subscription == 'type Subscription {')

// [description]
// @param {String} schemaFolderPath Path to the root folder containing the schema.graphql and resolver files.
Expand Down Expand Up @@ -80,7 +81,7 @@ const glue = (schemaFolderPath, options={}) => {
return { schema: s, resolver: a.resolver, query: q, mutation: m, subscription: sub }
}, { schema: '', resolver: {}, query: 'type Query {', mutation: 'type Mutation {', subscription: 'type Subscription {' })

if (!gluedSchema.schema) {
if (isMissingSchema(gluedSchema)) {
if (schemaPathInConfig)
throw new Error(`Missing GraphQL Schema: No schemas found under the path '${path.resolve(schemaPathInConfig)}' defined in the appconfig.json`)
else if (schemaFolderPath)
Expand Down
Loading

0 comments on commit 8017df3

Please sign in to comment.