Skip to content

Commit b310921

Browse files
committed
Iterate through all types, not just from query
1 parent b8c3d0d commit b310921

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/utilities/buildASTSchema.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,18 @@ export function buildASTSchema(
136136
throw new Error('Nothing constructed for ' + typeName);
137137
}
138138
innerTypeMap[typeName] = innerTypeDef;
139-
if (astMap[typeName].kind === INTERFACE_DEFINITION) {
140-
// Now that we've created and cached our interface, ensure
141-
// we create all implementations to point to it.
142-
makeInterfaceImplementations(astMap[typeName]);
143-
}
144139
return buildWrappedType(innerTypeDef, typeAST);
145140
};
146141
}
147142

148-
149143
var produceTypeDef = getTypeDefProducer(ast);
150144

151145
if (isNullish(astMap[queryTypeName])) {
152146
throw new Error(`Type ${queryTypeName} not found in document`);
153147
}
154148

149+
ast.definitions.forEach(produceTypeDef);
150+
155151
var queryType = produceTypeDef(astMap[queryTypeName]);
156152
var schema;
157153
if (isNullish(mutationTypeName)) {
@@ -216,16 +212,6 @@ export function buildASTSchema(
216212
return def.interfaces.map(inter => produceTypeDef(inter));
217213
}
218214

219-
function makeInterfaceImplementations(inter: InterfaceDefinition) {
220-
var interName = inter.name.value;
221-
var types = ast.definitions.filter(def => def.kind === TYPE_DEFINITION);
222-
var implementingTypes = types.filter(def => {
223-
var names = def.interfaces.map(namedType => namedType.name.value);
224-
return names.indexOf(interName) !== -1;
225-
});
226-
implementingTypes.forEach(produceTypeDef);
227-
}
228-
229215
function makeInputValues(values: Array<InputValueDefinition>) {
230216
return keyValMap(
231217
values,

0 commit comments

Comments
 (0)