1 | Object.defineProperty(exports, "__esModule", { value: true });
|
2 | var graphql_1 = require("graphql");
|
3 | var _1 = require(".");
|
4 |
|
5 | function checkForResolveTypeResolver(schema, requireResolversForResolveType) {
|
6 | Object.keys(schema.getTypeMap())
|
7 | .map(function (typeName) { return schema.getType(typeName); })
|
8 | .forEach(function (type) {
|
9 | if (!(type instanceof graphql_1.GraphQLUnionType ||
|
10 | type instanceof graphql_1.GraphQLInterfaceType)) {
|
11 | return;
|
12 | }
|
13 | if (!type.resolveType) {
|
14 | if (requireResolversForResolveType === false) {
|
15 | return;
|
16 | }
|
17 | if (requireResolversForResolveType === true) {
|
18 | throw new _1.SchemaError("Type \"" + type.name + "\" is missing a \"resolveType\" resolver");
|
19 | }
|
20 |
|
21 | console.warn("Type \"" + type.name + "\" is missing a \"__resolveType\" resolver. Pass false into " +
|
22 | "\"resolverValidationOptions.requireResolversForResolveType\" to disable this warning.");
|
23 | }
|
24 | });
|
25 | }
|
26 | exports.default = checkForResolveTypeResolver;
|
27 |
|
\ | No newline at end of file |