Skip to content

Commit

Permalink
Convert GraphQL SDL to AST before passing to Apollo (#1341)
Browse files Browse the repository at this point in the history
Apollo released a breaking change in a semver-minor which causes it to
stop understanding the SDL (string) GraphQL typeDefs we were passing it.
This fix ensures we're converting to an AST to avoid the error being
thrown.

See apollographql/apollo-server#2921

Fixes #1340
  • Loading branch information
jesstelford committed Jun 26, 2019
1 parent c2dc6eb commit de9e709
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .changeset/quiet-keys-agree/changes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "releases": [{ "name": "@keystone-alpha/keystone", "type": "patch" }], "dependents": [] }
8 changes: 8 additions & 0 deletions .changeset/quiet-keys-agree/changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Convert GraphQL SDL to AST before passing to Apollo

Apollo released a breaking change in a semver-minor which causes it to
stop understanding the SDL (string) GraphQL typeDefs we were passing it.
This fix ensures we're converting to an AST to avoid the error being
thrown.

See https://github.com/keystonejs/keystone-5/issues/1340
10 changes: 9 additions & 1 deletion packages/keystone/lib/Keystone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,15 @@ module.exports = class Keystone {
console.log(resolvers);
}

return { typeDefs, resolvers };
return {
typeDefs: typeDefs.map(
typeDef =>
gql`
${typeDef}
`
),
resolvers,
};
}

dumpSchema(file) {
Expand Down

0 comments on commit de9e709

Please sign in to comment.