Skip to content

Commit

Permalink
generateSchemaHash: changes necessary for graphql@16.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Aug 27, 2021
1 parent c9137b4 commit d7f7da8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/apollo-server-core/src/utils/schemaHash.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { parse } from 'graphql/language';
import { execute, ExecutionResult } from 'graphql/execution';
import { getIntrospectionQuery, IntrospectionSchema } from 'graphql/utilities';
import { getIntrospectionQuery, IntrospectionQuery } from 'graphql/utilities';
import stableStringify from 'fast-json-stable-stringify';
import { GraphQLSchema } from 'graphql/type';
import createSHA from './createSHA';
import { SchemaHash } from 'apollo-server-types';

export function generateSchemaHash(schema: GraphQLSchema): SchemaHash {
const introspectionQuery = getIntrospectionQuery();
const documentAST = parse(introspectionQuery);
const result = execute(schema, documentAST) as ExecutionResult;
const document = parse(introspectionQuery);
const result = execute({ schema, document }) as ExecutionResult<IntrospectionQuery>;

// If the execution of an introspection query results in a then-able, it
// indicates that one or more of its resolvers is behaving in an asynchronous
Expand All @@ -32,7 +32,7 @@ export function generateSchemaHash(schema: GraphQLSchema): SchemaHash {
throw new Error('Unable to generate server introspection document.');
}

const introspectionSchema: IntrospectionSchema = result.data.__schema;
const introspectionSchema = result.data.__schema;

// It's important that we perform a deterministic stringification here
// since, depending on changes in the underlying `graphql-js` execution
Expand Down

0 comments on commit d7f7da8

Please sign in to comment.