Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw an error on asynchronous introspection query behavior.
We expect introspection queries to behave in an synchronous manner since they do not have any resolvers which return Promises. This expectation seems to also be had by `graphql-js` which utilizes `graphqlSync`, rather than `graphql` for execution of introspection queries. In fact, this may be one of the entire reasons that `graphqlSync` exists: to fulfill a contract for synchronous execution of server introspection. The introspection tests within `graphql-js` seem to support this theory[[0]]. Utilities which wrap GraphQL resolvers should take care to maintain the execution dynamics of what they are wrapping, or they should avoid wrapping introspection types entirely by checking the type with the `isIntrospectionType` predicate function from `graphql/type`[[1]]. [0]: https://github.com/graphql/graphql-js/blob/787422956c9554d12d063a41fe35705335ec6290/src/type/__tests__/introspection-test.js [1]: https://github.com/graphql/graphql-js/blob/74d1e941/src/type/introspection.js#L484. Closes: #1935
- Loading branch information