@@ -365,6 +365,10 @@ export function diffTypeNodes(
365
365
366
366
const locationsDiff : Set < string > = new Set ( ) ;
367
367
368
+ const argumentsDiff : {
369
+ [ argumentName : string ] : string [ ] ;
370
+ } = Object . create ( null ) ;
371
+
368
372
const document : DocumentNode = {
369
373
kind : Kind . DOCUMENT ,
370
374
definitions : [ firstNode , secondNode ] ,
@@ -416,6 +420,27 @@ export function diffTypeNodes(
416
420
locationsDiff . add ( locationName ) ;
417
421
}
418
422
} ) ;
423
+
424
+ if ( ! node . arguments ) return ;
425
+
426
+ // Arguments must have the same name and type. As matches are found, they
427
+ // are deleted from the diff. Anything left in the diff after looping
428
+ // represents a discrepancy between the two sets of arguments.
429
+ node . arguments . forEach ( argument => {
430
+ const argumentName = argument . name . value ;
431
+ const printedType = print ( argument . type ) ;
432
+ if ( argumentsDiff [ argumentName ] ) {
433
+ if ( printedType === argumentsDiff [ argumentName ] [ 0 ] ) {
434
+ // If the existing entry is equal to printedType, it means there's no
435
+ // diff, so we can remove the entry from the diff object
436
+ delete argumentsDiff [ argumentName ] ;
437
+ } else {
438
+ argumentsDiff [ argumentName ] . push ( printedType ) ;
439
+ }
440
+ } else {
441
+ argumentsDiff [ argumentName ] = [ printedType ] ;
442
+ }
443
+ } ) ;
419
444
} ,
420
445
} ) ;
421
446
@@ -433,6 +458,7 @@ export function diffTypeNodes(
433
458
fields : fieldsDiff ,
434
459
unionTypes : unionTypesDiff ,
435
460
locations : Array . from ( locationsDiff ) ,
461
+ args : argumentsDiff ,
436
462
} ;
437
463
}
438
464
@@ -446,7 +472,7 @@ export function typeNodesAreEquivalent(
446
472
firstNode : TypeDefinitionNode | TypeExtensionNode | DirectiveDefinitionNode ,
447
473
secondNode : TypeDefinitionNode | TypeExtensionNode | DirectiveDefinitionNode ,
448
474
) {
449
- const { name, kind, fields, unionTypes, locations } = diffTypeNodes (
475
+ const { name, kind, fields, unionTypes, locations, args } = diffTypeNodes (
450
476
firstNode ,
451
477
secondNode ,
452
478
) ;
@@ -456,7 +482,8 @@ export function typeNodesAreEquivalent(
456
482
kind . length === 0 &&
457
483
Object . keys ( fields ) . length === 0 &&
458
484
Object . keys ( unionTypes ) . length === 0 &&
459
- locations . length === 0
485
+ locations . length === 0 &&
486
+ Object . keys ( args ) . length === 0
460
487
) ;
461
488
}
462
489
0 commit comments