@@ -444,37 +444,28 @@ def is_change_safe_for_object_or_interface_field(
444
444
if is_named_type (old_type ):
445
445
return (
446
446
# if they're both named types, see if their names are equivalent
447
- (
448
- is_named_type (new_type )
449
- and cast (GraphQLNamedType , old_type ).name
450
- == cast (GraphQLNamedType , new_type ).name
451
- )
452
- or
447
+ is_named_type (new_type )
448
+ and cast (GraphQLNamedType , old_type ).name
449
+ == cast (GraphQLNamedType , new_type ).name
450
+ ) or (
453
451
# moving from nullable to non-null of same underlying type is safe
454
- (
455
- is_non_null_type (new_type )
456
- and is_change_safe_for_object_or_interface_field (
457
- old_type , cast (GraphQLNonNull , new_type ).of_type
458
- )
452
+ is_non_null_type (new_type )
453
+ and is_change_safe_for_object_or_interface_field (
454
+ old_type , cast (GraphQLNonNull , new_type ).of_type
459
455
)
460
456
)
461
457
elif is_list_type (old_type ):
462
458
return (
463
459
# if they're both lists, make sure underlying types are compatible
464
- (
465
- is_list_type (new_type )
466
- and is_change_safe_for_object_or_interface_field (
467
- cast (GraphQLList , old_type ).of_type ,
468
- cast (GraphQLList , new_type ).of_type ,
469
- )
460
+ is_list_type (new_type )
461
+ and is_change_safe_for_object_or_interface_field (
462
+ cast (GraphQLList , old_type ).of_type , cast (GraphQLList , new_type ).of_type
470
463
)
471
- or
464
+ ) or (
472
465
# moving from nullable to non-null of same underlying type is safe
473
- (
474
- is_non_null_type (new_type )
475
- and is_change_safe_for_object_or_interface_field (
476
- old_type , cast (GraphQLNonNull , new_type ).of_type
477
- )
466
+ is_non_null_type (new_type )
467
+ and is_change_safe_for_object_or_interface_field (
468
+ old_type , cast (GraphQLNonNull , new_type ).of_type
478
469
)
479
470
)
480
471
elif is_non_null_type (old_type ):
@@ -493,36 +484,33 @@ def is_change_safe_for_input_object_field_or_field_arg(
493
484
old_type : GraphQLType , new_type : GraphQLType
494
485
) -> bool :
495
486
if is_named_type (old_type ):
496
- # if they're both named types, see if their names are equivalent
497
487
return (
488
+ # if they're both named types, see if their names are equivalent
498
489
is_named_type (new_type )
499
490
and cast (GraphQLNamedType , old_type ).name
500
491
== cast (GraphQLNamedType , new_type ).name
501
492
)
502
493
elif is_list_type (old_type ):
503
- # if they're both lists, make sure underlying types are compatible
494
+
504
495
return is_list_type (
496
+ # if they're both lists, make sure underlying types are compatible
505
497
new_type
506
498
) and is_change_safe_for_input_object_field_or_field_arg (
507
499
cast (GraphQLList , old_type ).of_type , cast (GraphQLList , new_type ).of_type
508
500
)
509
501
elif is_non_null_type (old_type ):
510
502
return (
511
503
# if they're both non-null, make sure the underlying types are compatible
512
- (
513
- is_non_null_type (new_type )
514
- and is_change_safe_for_input_object_field_or_field_arg (
515
- cast (GraphQLNonNull , old_type ).of_type ,
516
- cast (GraphQLNonNull , new_type ).of_type ,
517
- )
504
+ is_non_null_type (new_type )
505
+ and is_change_safe_for_input_object_field_or_field_arg (
506
+ cast (GraphQLNonNull , old_type ).of_type ,
507
+ cast (GraphQLNonNull , new_type ).of_type ,
518
508
)
519
- or
509
+ ) or (
520
510
# moving from non-null to nullable of same underlying type is safe
521
- (
522
- not is_non_null_type (new_type )
523
- and is_change_safe_for_input_object_field_or_field_arg (
524
- cast (GraphQLNonNull , old_type ).of_type , new_type
525
- )
511
+ not is_non_null_type (new_type )
512
+ and is_change_safe_for_input_object_field_or_field_arg (
513
+ cast (GraphQLNonNull , old_type ).of_type , new_type
526
514
)
527
515
)
528
516
else :
0 commit comments