Skip to content

Commit

Permalink
Simplify 'validateObjectInterfaces' function (#2208)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Oct 1, 2019
1 parent 01d4cf0 commit 6fc5e42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/type/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import find from '../polyfills/find';
import flatMap from '../polyfills/flatMap';
import objectValues from '../polyfills/objectValues';
import objectEntries from '../polyfills/objectEntries';

import inspect from '../jsutils/inspect';

Expand Down Expand Up @@ -337,6 +336,7 @@ function validateObjectInterfaces(
continue;
}
implementedTypeNames[iface.name] = true;

validateObjectImplementsInterface(context, object, iface);
}
}
Expand All @@ -347,10 +347,10 @@ function validateObjectImplementsInterface(
iface: GraphQLInterfaceType,
): void {
const objectFieldMap = object.getFields();
const ifaceFieldMap = iface.getFields();

// Assert each interface field is implemented.
for (const [fieldName, ifaceField] of objectEntries(ifaceFieldMap)) {
for (const ifaceField of objectValues(iface.getFields())) {
const fieldName = ifaceField.name;
const objectField = objectFieldMap[fieldName];

// Assert interface field exists on object.
Expand Down

0 comments on commit 6fc5e42

Please sign in to comment.