Skip to content

Commit 24464ab

Browse files
committed
Duplicate fields in deep inputs not validated properly
Replicates graphql/graphql-js@a001adb
1 parent 88a137e commit 24464ab

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ a query language for APIs created by Facebook.
1313
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
1414

1515
The current version 1.0.2 of GraphQL-core-next is up-to-date with GraphQL.js version
16-
14.1.1. All parts of the API are covered by an extensive test suite of currently 1730
16+
14.1.1. All parts of the API are covered by an extensive test suite of currently 1731
1717
unit tests.
1818

1919

graphql/validation/rules/unique_input_field_names.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, context: ASTValidationContext) -> None:
2525

2626
def enter_object_value(self, *_args):
2727
self.known_names_stack.append(self.known_names)
28-
self.known_names.clear()
28+
self.known_names = {}
2929

3030
def leave_object_value(self, *_args):
3131
self.known_names = self.known_names_stack.pop()
@@ -42,4 +42,3 @@ def enter_object_field(self, node: ObjectFieldNode, *_args):
4242
)
4343
else:
4444
known_names[field_name] = node.name
45-
return False

tests/validation/test_unique_input_field_names.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,13 @@ def many_duplicate_input_object_fields():
8383
""",
8484
[duplicate_field("f1", 3, 28, 3, 41), duplicate_field("f1", 3, 28, 3, 54)],
8585
)
86+
87+
def nested_duplicate_input_object_fields():
88+
assert_errors(
89+
"""
90+
{
91+
field(arg: { f1: {f2: "value", f2: "value" }})
92+
}
93+
""",
94+
[duplicate_field("f2", 3, 33, 3, 46)],
95+
)

0 commit comments

Comments
 (0)