How to use the apollo-server-express.mergeSchemas function in apollo-server-express

To help you get started, we’ve selected a few apollo-server-express examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nestjs / graphql / lib / graphql.factory.ts View on Github external
options.autoSchemaFile,
        options.buildSchemaOptions,
        this.resolversExplorerService.getAllCtors(),
      );
      const executableSchema = makeExecutableSchema({
        resolvers: extend(typesResolvers, options.resolvers),
        typeDefs: gql`
          ${printSchema(autoGeneratedSchema)}
        `,
        resolverValidationOptions: {
          ...(options.resolverValidationOptions || {}),
          requireResolversForResolveType: false,
        },
      });
      let schema = options.schema
        ? mergeSchemas({
            schemas: [options.schema, executableSchema],
          })
        : executableSchema;

      const autoGeneratedSchemaConfig = autoGeneratedSchema.toConfig();
      const executableSchemaConfig = executableSchema.toConfig();
      const schemaConfig = this.overrideOrExtendResolvers(
        executableSchemaConfig,
        autoGeneratedSchemaConfig,
      );

      schema = new GraphQLSchema(schemaConfig);
      return {
        ...options,
        typeDefs: undefined,
        schema: await transformSchema(schema),
github nestjs / graphql / lib / graphql.factory.ts View on Github external
...options,
        typeDefs: undefined,
        schema: await transformSchema(options.schema),
      };
    }
    const executableSchema = makeExecutableSchema({
      resolvers: extend(typesResolvers, options.resolvers),
      directiveResolvers: options.directiveResolvers,
      schemaDirectives: options.schemaDirectives as any,
      typeDefs: gql`
        ${options.typeDefs}
      `,
      resolverValidationOptions: options.resolverValidationOptions,
    });
    const schema = options.schema
      ? mergeSchemas({
          schemas: [options.schema, executableSchema],
        })
      : executableSchema;

    removeTempField(schema);
    return {
      ...options,
      typeDefs: undefined,
      schema: await transformSchema(schema),
    };
  }