Skip to content

Commit 425fd45

Browse files
committed
Experimenting with parents
1 parent 12f8330 commit 425fd45

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/introspection/introspection.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,20 @@ function addParent(schema: SimplifiedIntrospection) {
240240
/*
241241
* Group fields by their corresponding type id
242242
*/
243-
schema.types = R.groupBy(function (field) {
244-
return field.type.id;
245-
}, allFields);
243+
244+
245+
const mappings = R.map (
246+
x => R.map(y => y.id, x),
247+
R.groupBy(function (field) {
248+
return field.type.id;
249+
}, allFields)
250+
);
251+
252+
R.forEach(type => {
253+
if (mappings[type]) {
254+
(schema.types[type] as any).parents = mappings[type];
255+
}
256+
}, R.keys(schema.types));
246257
}
247258

248259
export function getSchema(schema: GraphQLSchema) {

0 commit comments

Comments
 (0)