Skip to content

Commit 96bd463

Browse files
committed
updated buildTypeWeights to handle inputObjectTypes
1 parent c6f051b commit 96bd463

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/analysis/buildTypeWeights.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import {
1313
isObjectType,
1414
isScalarType,
1515
isUnionType,
16+
isInputType,
1617
Kind,
1718
ValueNode,
1819
GraphQLUnionType,
1920
GraphQLFieldMap,
21+
isInputObjectType,
2022
} from 'graphql';
2123
import { ObjMap } from 'graphql/jsutils/ObjMap';
2224
import { GraphQLSchema } from 'graphql/type/schema';
@@ -351,7 +353,7 @@ function parseTypes(schema: GraphQLSchema, typeWeights: TypeWeightSet): TypeWeig
351353
};
352354
} else if (isUnionType(currentType)) {
353355
unions.push(currentType);
354-
} else if (!isScalarType(currentType)) {
356+
} else if (!isScalarType(currentType) && !isInputObjectType(currentType)) {
355357
throw new Error(`ERROR: buildTypeWeight: Unsupported type: ${currentType}`);
356358
}
357359
}

test/analysis/buildTypeWeights.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ describe('Test buildTypeWeightsFromSchema function', () => {
357357
mutation: {
358358
weight: 10,
359359
fields: {
360-
name: { weight: 0 },
361-
email: { weight: 0 },
360+
login: { resolveTo: 'user' },
362361
},
363362
},
364363
user: {

0 commit comments

Comments
 (0)