@@ -230,15 +230,7 @@ def extend_input_field_map(type_: GraphQLInputObjectType) -> GraphQLInputFieldMa
230230 if extensions :
231231 for extension in extensions :
232232 for field in extension .fields :
233- field_name = field .name .value
234- if field_name in old_field_map :
235- raise GraphQLError (
236- f"Field '{ type_ .name } .{ field_name } ' already"
237- " exists in the schema. It cannot also be defined"
238- " in this type extension." ,
239- [field ],
240- )
241- new_field_map [field_name ] = ast_builder .build_input_field (field )
233+ new_field_map [field .name .value ] = build_input_field (field )
242234
243235 return new_field_map
244236
@@ -444,15 +436,7 @@ def extend_field_map(
444436 # If there are any extensions to the fields, apply those here.
445437 for extension in type_extensions_map [type_ .name ]:
446438 for field in extension .fields :
447- field_name = field .name .value
448- if field_name in old_field_map :
449- raise GraphQLError (
450- f"Field '{ type_ .name } .{ field_name } '"
451- " already exists in the schema."
452- " It cannot also be defined in this type extension." ,
453- [field ],
454- )
455- new_field_map [field_name ] = build_field (field )
439+ new_field_map [field .name .value ] = build_field (field )
456440
457441 return new_field_map
458442
@@ -475,6 +459,7 @@ def resolve_type(type_name: str) -> GraphQLNamedType:
475459 type_definition_map , assume_valid = assume_valid , resolve_type = resolve_type
476460 )
477461 build_field = ast_builder .build_field
462+ build_input_field = ast_builder .build_input_field
478463 build_type = ast_builder .build_type
479464
480465 extend_type_cache : Dict [str , GraphQLNamedType ] = {}
@@ -492,7 +477,7 @@ def resolve_type(type_name: str) -> GraphQLNamedType:
492477 # Note: While this could make early assertions to get the correctly typed
493478 # values, that would throw immediately while type system validation with
494479 # `validate_schema()` will produce more actionable results.
495- operation_types [operation ] = ast_builder . build_type (operation_type .type )
480+ operation_types [operation ] = build_type (operation_type .type )
496481
497482 # Then, incorporate schema definition and all schema extensions.
498483 for schema_extension in schema_extensions :
@@ -503,7 +488,7 @@ def resolve_type(type_name: str) -> GraphQLNamedType:
503488 # typed values, that would throw immediately while type system
504489 # validation with `validate_schema()` will produce more actionable
505490 # results.
506- operation_types [operation ] = ast_builder . build_type (operation_type .type )
491+ operation_types [operation ] = build_type (operation_type .type )
507492
508493 schema_extension_ast_nodes = (
509494 schema .extension_ast_nodes or cast (Tuple [SchemaExtensionNode ], ())
@@ -513,7 +498,7 @@ def resolve_type(type_name: str) -> GraphQLNamedType:
513498 # any type not directly referenced by a value will get created.
514499 types = list (map (extend_named_type , schema .type_map .values ()))
515500 # do the same with new types
516- types .extend (map (ast_builder . build_type , type_definition_map .values ()))
501+ types .extend (map (build_type , type_definition_map .values ()))
517502
518503 # Then produce and return a Schema with these types.
519504 return GraphQLSchema ( # type: ignore
0 commit comments