Skip to content

Commit 2ce20e9

Browse files
authored
Minor validation tweaks from review (#4407)
Whilst reviewing that #3814 aligned with graphql/graphql-spec#793, I spotted these two minor improvements.
1 parent f808084 commit 2ce20e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/type/validate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ function createInputObjectDefaultValueCircularRefsValidator(
812812
): void {
813813
// Start with an empty object as a way to visit every field in this input
814814
// object type and apply every default value.
815-
return detectValueDefaultValueCycle(inputObj, {});
815+
return detectValueDefaultValueCycle(inputObj, Object.create(null));
816816
};
817817

818818
function detectValueDefaultValueCycle(
@@ -910,7 +910,7 @@ function createInputObjectDefaultValueCircularRefsValidator(
910910

911911
// Check to see if there is cycle.
912912
const cycleIndex = fieldPathIndex[fieldStr];
913-
if (cycleIndex !== undefined && cycleIndex > 0) {
913+
if (cycleIndex !== undefined) {
914914
context.reportError(
915915
`Invalid circular reference. The default value of Input Object field ${fieldStr} references itself${
916916
cycleIndex < fieldPath.length

0 commit comments

Comments
 (0)