Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a001adb

Browse files
CitoIvanGoncharov
authored andcommitted
Duplicate fields in deep inputs not validated properly (graphql#1791) (graphql#1792)
1 parent b8eb8de commit a001adb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/validation/__tests__/UniqueInputFieldNames-test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,12 @@ describe('Validate: Unique input field names', () => {
8888
duplicateField('f1', 3, 22, 3, 48),
8989
]);
9090
});
91+
92+
it('nested duplicate input object fields', () => {
93+
expectErrors(`
94+
{
95+
field(arg: { f1: {f2: "value", f2: "value" }})
96+
}
97+
`).to.deep.equal([duplicateField('f2', 3, 27, 3, 40)]);
98+
});
9199
});

src/validation/rules/UniqueInputFieldNames.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export function UniqueInputFieldNames(
4949
} else {
5050
knownNames[fieldName] = node.name;
5151
}
52-
return false;
5352
},
5453
};
5554
}

0 commit comments

Comments
 (0)