keystonejs / keystone

The superpowered headless CMS for Node.js — built with GraphQL and React
https://keystonejs.com
MIT License
9.18k stars 1.15k forks source link

Always use `context.graphql.schema` for `createExpressServer` #9029

Closed dcousens closed 7 months ago

dcousens commented 7 months ago

This pull request fixes createExpressServer to always use context.graphql.schema instead of the GraphQLSchema argument passed in.

Users downstream will nearly always be interacting with their GraphQL schema using the context.query and context.db methods. As part of https://github.com/keystonejs/keystone/pull/9028 we have deprecated the GraphQLSchema argument that was provided, but if users are using that instead of context.graphql.schema, then I think it is a safe assumption that downstream users would have expected that the the GraphQL schema provided should have been equal to the operating schema of context.

This could arguably be considered a breaking change, but I don't think anyone would have reasonably used the argument of createExpressServer (deprecated) to differentiate between the two possible schemas, therefore I think this is a patch that will help developers if they made an error in passing a different GraphQLSchema through.

codesandbox-ci[bot] commented 7 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 638d2509626014c8490525b5f3a51cf06cd92d1a:

Sandbox Source
@keystone-6/sandbox Configuration