Documentation
Migration
From Merge GraphQL Schemas

Migration from Merge GraphQL Schemas

Merge GraphQL Schemas was using GraphQL Toolkit’s @graphql-toolkit/schema-merging package under the hood, but we decided to deprecate it in favor of the new GraphQL Tools @graphql-tools/merge package and you need to update your project.

Merging Type Definitions

Instead of mergeTypes, you need to use mergeTypeDefs from @graphql-tools/merge package. The API is almost same except schemaDefinition option.

We were using the following implementation to proxy mergeTypes to mergeTypeDefs of GraphQL Toolkit.

import { mergeTypeDefs } from '@graphql-toolkit/schema-merging'
 
type Config = Parameters<typeof mergeTypeDefs>[1]
 
export const mergeTypes = (
  types: any[],
  options?: { schemaDefinition?: boolean; all?: boolean } & Partial<Config>
) => {
  const schemaDefinition =
    options && typeof options.schemaDefinition === 'boolean' ? options.schemaDefinition : true
 
  return mergeTypeDefs(types, {
    useSchemaDefinition: schemaDefinition,
    forceSchemaDefinition: schemaDefinition,
    throwOnConflict: true,
    commentDescriptions: true,
    reverseDirectives: true,
    ...options
  })
}

So if you want to have exact behavior, you can use the options above. Other than that, the API and behavior are almost the same.

import { fileLoader, mergeResolvers, mergeTypes } from 'merge-graphql-schemas'

should become:

import { loadFilesSync } from '@graphql-tools/load-files'
import { mergeResolvers, mergeTypeDefs } from '@graphql-tools/merge'

So you can replace mergeTypes with mergeTypeDefs and fileLoader with loadFilesSync.