Skip to content

Commit c9e0227

Browse files
committed
validate_schema: remove validation arguments uniqueness
In both 'GraphQLField' and 'GraphQLDirective', arguments are specified as dict and can't duplicate by definition. Replicates graphql/graphql-js@28511bf
1 parent 248e100 commit c9e0227

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/graphql/type/validate.py

-32
Original file line numberDiff line numberDiff line change
@@ -152,26 +152,10 @@ def validate_directives(self) -> None:
152152
self.validate_name(directive)
153153

154154
# Ensure the arguments are valid.
155-
arg_names: Set[str] = set()
156155
for arg_name, arg in directive.args.items():
157156
# Ensure they are named correctly.
158157
self.validate_name(arg, arg_name)
159158

160-
# Ensure they are unique per directive.
161-
if arg_name in arg_names:
162-
self.report_error(
163-
f"Argument @{directive.name}({arg_name}:)"
164-
" can only be defined once.",
165-
directive.ast_node
166-
and [
167-
arg.ast_node
168-
for name, arg in directive.args.items()
169-
if name == arg_name
170-
],
171-
)
172-
continue
173-
arg_names.add(arg_name)
174-
175159
# Ensure the type is an input type.
176160
if not is_input_type(arg.type):
177161
self.report_error(
@@ -266,26 +250,10 @@ def validate_fields(
266250
)
267251

268252
# Ensure the arguments are valid.
269-
arg_names: Set[str] = set()
270253
for arg_name, arg in field.args.items():
271254
# Ensure they are named correctly.
272255
self.validate_name(arg, arg_name)
273256

274-
# Ensure they are unique per field.
275-
if arg_name in arg_names:
276-
self.report_error(
277-
"Field argument"
278-
f" {type_.name}.{field_name}({arg_name}:)"
279-
" can only be defined once.",
280-
[
281-
arg.ast_node
282-
for name, arg in field.args.items()
283-
if name == arg_name
284-
],
285-
)
286-
break
287-
arg_names.add(arg_name)
288-
289257
# Ensure the type is an input type.
290258
if not is_input_type(arg.type):
291259
self.report_error(

0 commit comments

Comments
 (0)