@@ -136,7 +136,7 @@ def validate_root_types(self) -> None:
136136 )
137137 self .report_error (
138138 "All root types must be different,"
139- f" '{ root_type . name } ' type is used as { operation_list } root types." ,
139+ f" '{ root_type } ' type is used as { operation_list } root types." ,
140140 [
141141 get_operation_type_node (schema , operation_type )
142142 for operation_type in operation_types
@@ -159,7 +159,7 @@ def validate_directives(self) -> None:
159159
160160 if not directive .locations :
161161 self .report_error (
162- f"Directive @ { directive . name } must include 1 or more locations." ,
162+ f"Directive { directive } must include 1 or more locations." ,
163163 directive .ast_node ,
164164 )
165165
@@ -171,14 +171,14 @@ def validate_directives(self) -> None:
171171 # Ensure the type is an input type.
172172 if not is_input_type (arg .type ):
173173 self .report_error (
174- f"The type of @ { directive . name } ({ arg_name } :)"
174+ f"The type of { directive } ({ arg_name } :)"
175175 f" must be Input Type but got: { inspect (arg .type )} ." ,
176176 arg .ast_node ,
177177 )
178178
179179 if is_required_argument (arg ) and arg .deprecation_reason is not None :
180180 self .report_error (
181- f"Required argument @ { directive . name } ({ arg_name } :)"
181+ f"Required argument { directive } ({ arg_name } :)"
182182 " cannot be deprecated." ,
183183 [
184184 get_deprecated_directive_node (arg .ast_node ),
@@ -249,7 +249,7 @@ def validate_fields(self, type_: GraphQLObjectType | GraphQLInterfaceType) -> No
249249 # Objects and Interfaces both must define one or more fields.
250250 if not fields :
251251 self .report_error (
252- f"Type { type_ . name } must define one or more fields." ,
252+ f"Type { type_ } must define one or more fields." ,
253253 [type_ .ast_node , * type_ .extension_ast_nodes ],
254254 )
255255
@@ -260,7 +260,7 @@ def validate_fields(self, type_: GraphQLObjectType | GraphQLInterfaceType) -> No
260260 # Ensure the type is an output type
261261 if not is_output_type (field .type ):
262262 self .report_error (
263- f"The type of { type_ . name } .{ field_name } "
263+ f"The type of { type_ } .{ field_name } "
264264 f" must be Output Type but got: { inspect (field .type )} ." ,
265265 field .ast_node and field .ast_node .type ,
266266 )
@@ -273,14 +273,14 @@ def validate_fields(self, type_: GraphQLObjectType | GraphQLInterfaceType) -> No
273273 # Ensure the type is an input type.
274274 if not is_input_type (arg .type ):
275275 self .report_error (
276- f"The type of { type_ . name } .{ field_name } ({ arg_name } :)"
276+ f"The type of { type_ } .{ field_name } ({ arg_name } :)"
277277 f" must be Input Type but got: { inspect (arg .type )} ." ,
278278 arg .ast_node and arg .ast_node .type ,
279279 )
280280
281281 if is_required_argument (arg ) and arg .deprecation_reason is not None :
282282 self .report_error (
283- f"Required argument { type_ . name } .{ field_name } ({ arg_name } :)"
283+ f"Required argument { type_ } .{ field_name } ({ arg_name } :)"
284284 " cannot be deprecated." ,
285285 [
286286 get_deprecated_directive_node (arg .ast_node ),
@@ -303,14 +303,14 @@ def validate_interfaces(
303303
304304 if type_ is iface :
305305 self .report_error (
306- f"Type { type_ . name } cannot implement itself"
306+ f"Type { type_ } cannot implement itself"
307307 " because it would create a circular reference." ,
308308 get_all_implements_interface_nodes (type_ , iface ),
309309 )
310310
311311 if iface .name in iface_type_names :
312312 self .report_error (
313- f"Type { type_ . name } can only implement { iface .name } once." ,
313+ f"Type { type_ } can only implement { iface .name } once." ,
314314 get_all_implements_interface_nodes (type_ , iface ),
315315 )
316316 continue
@@ -335,7 +335,7 @@ def validate_type_implements_interface(
335335 if not type_field :
336336 self .report_error (
337337 f"Interface field { iface .name } .{ field_name } "
338- f" expected but { type_ . name } does not provide it." ,
338+ f" expected but { type_ } does not provide it." ,
339339 [
340340 iface_field .ast_node ,
341341 type_ .ast_node ,
@@ -350,7 +350,7 @@ def validate_type_implements_interface(
350350 self .report_error (
351351 f"Interface field { iface .name } .{ field_name } "
352352 f" expects type { iface_field .type } "
353- f" but { type_ . name } .{ field_name } "
353+ f" but { type_ } .{ field_name } "
354354 f" is type { type_field .type } ." ,
355355 [
356356 iface_field .ast_node and iface_field .ast_node .type ,
@@ -367,7 +367,7 @@ def validate_type_implements_interface(
367367 self .report_error (
368368 "Interface field argument"
369369 f" { iface .name } .{ field_name } ({ arg_name } :)"
370- f" expected but { type_ . name } .{ field_name } "
370+ f" expected but { type_ } .{ field_name } "
371371 " does not provide it." ,
372372 [iface_arg .ast_node , type_field .ast_node ],
373373 )
@@ -380,7 +380,7 @@ def validate_type_implements_interface(
380380 "Interface field argument"
381381 f" { iface .name } .{ field_name } ({ arg_name } :)"
382382 f" expects type { iface_arg .type } "
383- f" but { type_ . name } .{ field_name } ({ arg_name } :)"
383+ f" but { type_ } .{ field_name } ({ arg_name } :)"
384384 f" is type { type_arg .type } ." ,
385385 [
386386 iface_arg .ast_node and iface_arg .ast_node .type ,
@@ -393,9 +393,9 @@ def validate_type_implements_interface(
393393 iface_arg = iface_field .args .get (arg_name )
394394 if not iface_arg and is_required_argument (type_arg ):
395395 self .report_error (
396- f"Object field { type_ . name } .{ field_name } includes "
397- f" required argument { arg_name } that is missing from "
398- f" the Interface field { iface .name } .{ field_name } ." ,
396+ f"Argument ' { type_ } .{ field_name } ( { arg_name } :)' must not be "
397+ f" required type ' { inspect ( type_arg . type ) } ' if not provided "
398+ f" by the Interface field ' { iface .name } .{ field_name } ' ." ,
399399 [type_arg .ast_node , iface_field .ast_node ],
400400 )
401401
@@ -408,10 +408,10 @@ def validate_type_implements_ancestors(
408408 for transitive in iface_interfaces :
409409 if transitive not in type_interfaces :
410410 self .report_error (
411- f"Type { type_ . name } cannot implement { iface .name } "
411+ f"Type { type_ } cannot implement { iface .name } "
412412 " because it would create a circular reference."
413413 if transitive is type_
414- else f"Type { type_ . name } must implement { transitive .name } "
414+ else f"Type { type_ } must implement { transitive .name } "
415415 f" because it is implemented by { iface .name } ." ,
416416 get_all_implements_interface_nodes (iface , transitive )
417417 + get_all_implements_interface_nodes (type_ , iface ),
@@ -432,7 +432,7 @@ def validate_union_members(self, union: GraphQLUnionType) -> None:
432432 if member_type .name in included_type_names :
433433 self .report_error (
434434 f"Union type { union .name } can only include type"
435- f" { member_type . name } once." ,
435+ f" { member_type } once." ,
436436 get_union_member_type_nodes (union , member_type .name ),
437437 )
438438 else :
@@ -449,7 +449,7 @@ def validate_enum_values(self, enum_type: GraphQLEnumType) -> None:
449449
450450 if not enum_values :
451451 self .report_error (
452- f"Enum type { enum_type . name } must define one or more values." ,
452+ f"Enum type { enum_type } must define one or more values." ,
453453 [enum_type .ast_node , * enum_type .extension_ast_nodes ],
454454 )
455455
@@ -500,14 +500,13 @@ def validate_one_of_input_object_field(
500500 ) -> None :
501501 if is_non_null_type (field .type ):
502502 self .report_error (
503- f"OneOf input field { type_ . name } .{ field_name } must be nullable." ,
503+ f"OneOf input field { type_ } .{ field_name } must be nullable." ,
504504 field .ast_node and field .ast_node .type ,
505505 )
506506
507507 if field .default_value is not Undefined :
508508 self .report_error (
509- f"OneOf input field { type_ .name } .{ field_name } "
510- " cannot have a default value." ,
509+ f"OneOf input field { type_ } .{ field_name } cannot have a default value." ,
511510 field .ast_node ,
512511 )
513512
@@ -565,7 +564,7 @@ def __call__(self, input_obj: GraphQLInputObjectType) -> None:
565564 cycle_path = self .field_path [cycle_index :]
566565 field_names = map (itemgetter (0 ), cycle_path )
567566 self .context .report_error (
568- f"Cannot reference Input Object '{ field_type . name } '"
567+ f"Cannot reference Input Object '{ field_type } '"
569568 " within itself through a series of non-null fields:"
570569 f" '{ '.' .join (field_names )} '." ,
571570 cast (
0 commit comments