Skip to content

Commit

Permalink
Duplicate fields in deep inputs not validated properly (#1791) (#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored and IvanGoncharov committed Mar 15, 2019
1 parent b8eb8de commit a001adb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/validation/__tests__/UniqueInputFieldNames-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,12 @@ describe('Validate: Unique input field names', () => {
duplicateField('f1', 3, 22, 3, 48),
]);
});

it('nested duplicate input object fields', () => {
expectErrors(`
{
field(arg: { f1: {f2: "value", f2: "value" }})
}
`).to.deep.equal([duplicateField('f2', 3, 27, 3, 40)]);
});
});
1 change: 0 additions & 1 deletion src/validation/rules/UniqueInputFieldNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export function UniqueInputFieldNames(
} else {
knownNames[fieldName] = node.name;
}
return false;
},
};
}

0 comments on commit a001adb

Please sign in to comment.