keystone icon indicating copy to clipboard operation
keystone copied to clipboard

Removes `graphQLSchemaExtension` export in favour of using either `graphql.extend` or `@graphql-tool/schema`

Open borisno2 opened this issue 3 years ago • 2 comments

Removes the graphQLSchemaExtension export from @keystone-6/core in favour of using either graphql.extend or @graphql-tool/schema directly.

This API used @graphql-tools/schema to merge custom typeDefs and resolvers into the keystone-generated GraphQL schema. Removing this API still allows a developer to use @graphql-tools/schema for the same outcome, just more explicitly.

So instead of:

export const extendGraphqlSchema = graphQLSchemaExtension<Context>({
  typeDefs:`
        type Mutation {
           // Custom Mutation Types
        }
    `,
  resolvers: {
      // Custom Resolvers
   }

Now it would look like this:

import { mergeSchemas } from '@graphql-tools/schema';

export const extendGraphqlSchema = (schema: GraphQLSchema) =>
  mergeSchemas({
    schemas: [schema],
    typeDefs: `
        type Mutation {
           // Custom Mutation Types
        }
    `,
  resolvers: {
      // Custom Resolvers
   }
});

Also updated docs and added a guide for using extendGraphqlSchema

borisno2 avatar Sep 21 '22 05:09 borisno2

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
keystone-next-docs ✅ Ready (Inspect) Visit Preview Sep 29, 2022 at 4:21AM (UTC)

vercel[bot] avatar Sep 21 '22 05:09 vercel[bot]

🦋 Changeset detected

Latest commit: 44bdee86a87fc344add7d2456e6f6a8f46195348

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 44 packages
Name Type
@keystone-6/core Major
@keystone-6/example-assets-local Patch
@keystone-6/example-assets-s3 Patch
@keystone-6/example-auth Patch
@keystone-6/example-app-basic Patch
@keystone-6/example-blog Patch
@keystone-6/example-custom-admin-ui-logo Patch
@keystone-6/example-custom-admin-ui-navigation Patch
@keystone-6/example-custom-admin-ui-pages Patch
@keystone-6/example-custom-field-view Patch
@keystone-6/example-custom-field Patch
@keystone-6/example-with-custom-session-validation Patch
@keystone-6/example-default-values Patch
@keystone-6/example-document-field Patch
@keystone-6/example-ecommerce Patch
@keystone-6/example-embedded-nextjs Patch
@keystone-6/example-extend-graphql-schema-graphql-tools Patch
@keystone-6/example-extend-graphql-schema-graphql-ts Patch
@keystone-6/example-extend-graphql-schema-nexus Patch
@keystone-6/example-extend-graphql-subscriptions Patch
@keystone-6/example-feature-boilerplate Patch
@keystone-6/example-graphql-ts-gql Patch
@keystone-6/example-json-field Patch
@keystone-6/example-rest-api Patch
@keystone-6/example-roles Patch
@keystone-6/example-script Patch
@keystone-6/singleton Patch
@keystone-6/example-task-manager Patch
@keystone-6/example-testing Patch
@keystone-6/example-virtual-field Patch
@keystone-6/example-with-auth Patch
@keystone-6/example-document-field-customisation-keystone-server Patch
@keystone-6/example-e2e-boilerplate-keystone-server Patch
@keystone-6/auth Major
@keystone-6/cloudinary Major
@keystone-6/fields-document Major
@keystone-6/session-store-redis Major
@keystone-6/benchmarks-legacy Patch
@keystone-6/test-projects-basic Patch
@keystone-6/test-projects-crud-notifications Patch
@keystone-6/test-projects-live-reloading Patch
@keystone-6/sandbox Patch
@keystone-6/generate-artifacts-for-projects Patch
@keystone-6/website Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Sep 21 '22 05:09 changeset-bot[bot]

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 44bdee86a87fc344add7d2456e6f6a8f46195348:

Sandbox Source
@keystone-6/sandbox Configuration

codesandbox-ci[bot] avatar Sep 26 '22 01:09 codesandbox-ci[bot]