1- name: unique fields
2 rule: OverlappingFieldsCanBeMerged
3 schema: 0
4 query: |2-
5
6 fragment uniqueFields on Dog {
7 name
8 nickname
9 }
10
11 errors: []
12- name: identical fields
13 rule: OverlappingFieldsCanBeMerged
14 schema: 0
15 query: |2-
16
17 fragment mergeIdenticalFields on Dog {
18 name
19 name
20 }
21
22 errors: []
23- name: identical fields with identical args
24 rule: OverlappingFieldsCanBeMerged
25 schema: 0
26 query: |2-
27
28 fragment mergeIdenticalFieldsWithIdenticalArgs on Dog {
29 doesKnowCommand(dogCommand: SIT)
30 doesKnowCommand(dogCommand: SIT)
31 }
32
33 errors: []
34- name: identical fields with identical directives
35 rule: OverlappingFieldsCanBeMerged
36 schema: 0
37 query: |2-
38
39 fragment mergeSameFieldsWithSameDirectives on Dog {
40 name @include(if: true)
41 name @include(if: true)
42 }
43
44 errors: []
45- name: different args with different aliases
46 rule: OverlappingFieldsCanBeMerged
47 schema: 0
48 query: |2-
49
50 fragment differentArgsWithDifferentAliases on Dog {
51 knowsSit: doesKnowCommand(dogCommand: SIT)
52 knowsDown: doesKnowCommand(dogCommand: DOWN)
53 }
54
55 errors: []
56- name: different directives with different aliases
57 rule: OverlappingFieldsCanBeMerged
58 schema: 0
59 query: |2-
60
61 fragment differentDirectivesWithDifferentAliases on Dog {
62 nameIfTrue: name @include(if: true)
63 nameIfFalse: name @include(if: false)
64 }
65
66 errors: []
67- name: different skip/include directives accepted
68 rule: OverlappingFieldsCanBeMerged
69 schema: 0
70 query: |2-
71
72 fragment differentDirectivesWithDifferentAliases on Dog {
73 name @include(if: true)
74 name @include(if: false)
75 }
76
77 errors: []
78- name: Same aliases with different field targets
79 rule: OverlappingFieldsCanBeMerged
80 schema: 0
81 query: |2-
82
83 fragment sameAliasesWithDifferentFieldTargets on Dog {
84 fido: name
85 fido: nickname
86 }
87
88 errors:
89 - message: Fields "fido" conflict because "name" and "nickname" are different fields. Use different aliases on the fields to fetch both if this was intentional.
90 locations:
91 - {line: 3, column: 9}
92 - {line: 4, column: 9}
93- name: Same aliases allowed on non-overlapping fields
94 rule: OverlappingFieldsCanBeMerged
95 schema: 0
96 query: |2-
97
98 fragment sameAliasesWithDifferentFieldTargets on Pet {
99 ... on Dog {
100 name
101 }
102 ... on Cat {
103 name: nickname
104 }
105 }
106
107 errors: []
108- name: Alias masking direct field access
109 rule: OverlappingFieldsCanBeMerged
110 schema: 0
111 query: |2-
112
113 fragment aliasMaskingDirectFieldAccess on Dog {
114 name: nickname
115 name
116 }
117
118 errors:
119 - message: Fields "name" conflict because "nickname" and "name" are different fields. Use different aliases on the fields to fetch both if this was intentional.
120 locations:
121 - {line: 3, column: 9}
122 - {line: 4, column: 9}
123- name: different args, second adds an argument
124 rule: OverlappingFieldsCanBeMerged
125 schema: 0
126 query: |2-
127
128 fragment conflictingArgs on Dog {
129 doesKnowCommand
130 doesKnowCommand(dogCommand: HEEL)
131 }
132
133 errors:
134 - message: Fields "doesKnowCommand" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.
135 locations:
136 - {line: 3, column: 9}
137 - {line: 4, column: 9}
138- name: different args, second missing an argument
139 rule: OverlappingFieldsCanBeMerged
140 schema: 0
141 query: |2-
142
143 fragment conflictingArgs on Dog {
144 doesKnowCommand(dogCommand: SIT)
145 doesKnowCommand
146 }
147
148 errors:
149 - message: Fields "doesKnowCommand" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.
150 locations:
151 - {line: 3, column: 9}
152 - {line: 4, column: 9}
153- name: conflicting arg values
154 rule: OverlappingFieldsCanBeMerged
155 schema: 0
156 query: |2-
157
158 fragment conflictingArgs on Dog {
159 doesKnowCommand(dogCommand: SIT)
160 doesKnowCommand(dogCommand: HEEL)
161 }
162
163 errors:
164 - message: Fields "doesKnowCommand" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.
165 locations:
166 - {line: 3, column: 9}
167 - {line: 4, column: 9}
168- name: conflicting arg names
169 rule: OverlappingFieldsCanBeMerged
170 schema: 0
171 query: |2-
172
173 fragment conflictingArgs on Dog {
174 isAtLocation(x: 0)
175 isAtLocation(y: 0)
176 }
177
178 errors:
179 - message: Fields "isAtLocation" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.
180 locations:
181 - {line: 3, column: 9}
182 - {line: 4, column: 9}
183- name: allows different args where no conflict is possible
184 rule: OverlappingFieldsCanBeMerged
185 schema: 0
186 query: |2-
187
188 fragment conflictingArgs on Pet {
189 ... on Dog {
190 name(surname: true)
191 }
192 ... on Cat {
193 name
194 }
195 }
196
197 errors: []
198- name: allows different order of args
199 rule: OverlappingFieldsCanBeMerged
200 schema: 10
201 query: |2-
202
203 {
204 someField(a: null, b: null)
205 someField(b: null, a: null)
206 }
207
208 errors: []
209- name: allows different order of input object fields in arg values
210 rule: OverlappingFieldsCanBeMerged
211 schema: 11
212 query: |2-
213
214 {
215 someField(arg: { a: null, b: null })
216 someField(arg: { b: null, a: null })
217 }
218
219 errors: []
220- name: encounters conflict in fragments
221 rule: OverlappingFieldsCanBeMerged
222 schema: 0
223 query: |2-
224
225 {
226 ...A
227 ...B
228 }
229 fragment A on Type {
230 x: a
231 }
232 fragment B on Type {
233 x: b
234 }
235
236 errors:
237 - message: Fields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.
238 locations:
239 - {line: 7, column: 9}
240 - {line: 10, column: 9}
241- name: reports each conflict once
242 rule: OverlappingFieldsCanBeMerged
243 schema: 0
244 query: |2-
245
246 {
247 f1 {
248 ...A
249 ...B
250 }
251 f2 {
252 ...B
253 ...A
254 }
255 f3 {
256 ...A
257 ...B
258 x: c
259 }
260 }
261 fragment A on Type {
262 x: a
263 }
264 fragment B on Type {
265 x: b
266 }
267
268 errors:
269 - message: Fields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.
270 locations:
271 - {line: 18, column: 9}
272 - {line: 21, column: 9}
273 - message: Fields "x" conflict because "c" and "a" are different fields. Use different aliases on the fields to fetch both if this was intentional.
274 locations:
275 - {line: 14, column: 11}
276 - {line: 18, column: 9}
277 - message: Fields "x" conflict because "c" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.
278 locations:
279 - {line: 14, column: 11}
280 - {line: 21, column: 9}
281- name: deep conflict
282 rule: OverlappingFieldsCanBeMerged
283 schema: 0
284 query: |2-
285
286 {
287 field {
288 x: a
289 },
290 field {
291 x: b
292 }
293 }
294
295 errors:
296 - message: Fields "field" conflict because subfields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.
297 locations:
298 - {line: 3, column: 9}
299 - {line: 4, column: 11}
300 - {line: 6, column: 9}
301 - {line: 7, column: 11}
302- name: deep conflict with multiple issues
303 rule: OverlappingFieldsCanBeMerged
304 schema: 0
305 query: |2-
306
307 {
308 field {
309 x: a
310 y: c
311 },
312 field {
313 x: b
314 y: d
315 }
316 }
317
318 errors:
319 - message: Fields "field" conflict because subfields "x" conflict because "a" and "b" are different fields and subfields "y" conflict because "c" and "d" are different fields. Use different aliases on the fields to fetch both if this was intentional.
320 locations:
321 - {line: 3, column: 9}
322 - {line: 4, column: 11}
323 - {line: 5, column: 11}
324 - {line: 7, column: 9}
325 - {line: 8, column: 11}
326 - {line: 9, column: 11}
327- name: very deep conflict
328 rule: OverlappingFieldsCanBeMerged
329 schema: 0
330 query: |2-
331
332 {
333 field {
334 deepField {
335 x: a
336 }
337 },
338 field {
339 deepField {
340 x: b
341 }
342 }
343 }
344
345 errors:
346 - message: Fields "field" conflict because subfields "deepField" conflict because subfields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.
347 locations:
348 - {line: 3, column: 9}
349 - {line: 4, column: 11}
350 - {line: 5, column: 13}
351 - {line: 8, column: 9}
352 - {line: 9, column: 11}
353 - {line: 10, column: 13}
354- name: reports deep conflict to nearest common ancestor
355 rule: OverlappingFieldsCanBeMerged
356 schema: 0
357 query: |2-
358
359 {
360 field {
361 deepField {
362 x: a
363 }
364 deepField {
365 x: b
366 }
367 },
368 field {
369 deepField {
370 y
371 }
372 }
373 }
374
375 errors:
376 - message: Fields "deepField" conflict because subfields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.
377 locations:
378 - {line: 4, column: 11}
379 - {line: 5, column: 13}
380 - {line: 7, column: 11}
381 - {line: 8, column: 13}
382- name: reports deep conflict to nearest common ancestor in fragments
383 rule: OverlappingFieldsCanBeMerged
384 schema: 0
385 query: |2-
386
387 {
388 field {
389 ...F
390 }
391 field {
392 ...F
393 }
394 }
395 fragment F on T {
396 deepField {
397 deeperField {
398 x: a
399 }
400 deeperField {
401 x: b
402 }
403 },
404 deepField {
405 deeperField {
406 y
407 }
408 }
409 }
410
411 errors:
412 - message: Fields "deeperField" conflict because subfields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.
413 locations:
414 - {line: 12, column: 11}
415 - {line: 13, column: 13}
416 - {line: 15, column: 11}
417 - {line: 16, column: 13}
418- name: reports deep conflict in nested fragments
419 rule: OverlappingFieldsCanBeMerged
420 schema: 0
421 query: |2-
422
423 {
424 field {
425 ...F
426 }
427 field {
428 ...I
429 }
430 }
431 fragment F on T {
432 x: a
433 ...G
434 }
435 fragment G on T {
436 y: c
437 }
438 fragment I on T {
439 y: d
440 ...J
441 }
442 fragment J on T {
443 x: b
444 }
445
446 errors:
447 - message: Fields "field" conflict because subfields "x" conflict because "a" and "b" are different fields and subfields "y" conflict because "c" and "d" are different fields. Use different aliases on the fields to fetch both if this was intentional.
448 locations:
449 - {line: 3, column: 9}
450 - {line: 11, column: 9}
451 - {line: 15, column: 9}
452 - {line: 6, column: 9}
453 - {line: 22, column: 9}
454 - {line: 18, column: 9}
455- name: ignores unknown fragments
456 rule: OverlappingFieldsCanBeMerged
457 schema: 0
458 query: |2-
459
460 {
461 field
462 ...Unknown
463 ...Known
464 }
465
466 fragment Known on T {
467 field
468 ...OtherUnknown
469 }
470
471 errors: []
472- name: return types must be unambiguous/conflicting return types which potentially overlap
473 rule: OverlappingFieldsCanBeMerged
474 schema: 12
475 query: |2-
476
477 {
478 someBox {
479 ...on IntBox {
480 scalar
481 }
482 ...on NonNullStringBox1 {
483 scalar
484 }
485 }
486 }
487
488 errors:
489 - message: Fields "scalar" conflict because they return conflicting types "Int" and "String!". Use different aliases on the fields to fetch both if this was intentional.
490 locations:
491 - {line: 5, column: 17}
492 - {line: 8, column: 17}
493- name: return types must be unambiguous/compatible return shapes on different return types
494 rule: OverlappingFieldsCanBeMerged
495 schema: 12
496 query: |2-
497
498 {
499 someBox {
500 ... on SomeBox {
501 deepBox {
502 unrelatedField
503 }
504 }
505 ... on StringBox {
506 deepBox {
507 unrelatedField
508 }
509 }
510 }
511 }
512
513 errors: []
514- name: return types must be unambiguous/disallows differing return types despite no overlap
515 rule: OverlappingFieldsCanBeMerged
516 schema: 12
517 query: |2-
518
519 {
520 someBox {
521 ... on IntBox {
522 scalar
523 }
524 ... on StringBox {
525 scalar
526 }
527 }
528 }
529
530 errors:
531 - message: Fields "scalar" conflict because they return conflicting types "Int" and "String". Use different aliases on the fields to fetch both if this was intentional.
532 locations:
533 - {line: 5, column: 17}
534 - {line: 8, column: 17}
535- name: return types must be unambiguous/reports correctly when a non-exclusive follows an exclusive
536 rule: OverlappingFieldsCanBeMerged
537 schema: 12
538 query: |2-
539
540 {
541 someBox {
542 ... on IntBox {
543 deepBox {
544 ...X
545 }
546 }
547 }
548 someBox {
549 ... on StringBox {
550 deepBox {
551 ...Y
552 }
553 }
554 }
555 memoed: someBox {
556 ... on IntBox {
557 deepBox {
558 ...X
559 }
560 }
561 }
562 memoed: someBox {
563 ... on StringBox {
564 deepBox {
565 ...Y
566 }
567 }
568 }
569 other: someBox {
570 ...X
571 }
572 other: someBox {
573 ...Y
574 }
575 }
576 fragment X on SomeBox {
577 scalar
578 }
579 fragment Y on SomeBox {
580 scalar: unrelatedField
581 }
582
583 errors:
584 - message: Fields "other" conflict because subfields "scalar" conflict because "scalar" and "unrelatedField" are different fields. Use different aliases on the fields to fetch both if this was intentional.
585 locations:
586 - {line: 31, column: 13}
587 - {line: 39, column: 13}
588 - {line: 34, column: 13}
589 - {line: 42, column: 13}
590- name: return types must be unambiguous/disallows differing return type nullability despite no overlap
591 rule: OverlappingFieldsCanBeMerged
592 schema: 12
593 query: |2-
594
595 {
596 someBox {
597 ... on NonNullStringBox1 {
598 scalar
599 }
600 ... on StringBox {
601 scalar
602 }
603 }
604 }
605
606 errors:
607 - message: Fields "scalar" conflict because they return conflicting types "String!" and "String". Use different aliases on the fields to fetch both if this was intentional.
608 locations:
609 - {line: 5, column: 17}
610 - {line: 8, column: 17}
611- name: return types must be unambiguous/disallows differing return type list despite no overlap
612 rule: OverlappingFieldsCanBeMerged
613 schema: 12
614 query: |2-
615
616 {
617 someBox {
618 ... on IntBox {
619 box: listStringBox {
620 scalar
621 }
622 }
623 ... on StringBox {
624 box: stringBox {
625 scalar
626 }
627 }
628 }
629 }
630
631 errors:
632 - message: Fields "box" conflict because they return conflicting types "[StringBox]" and "StringBox". Use different aliases on the fields to fetch both if this was intentional.
633 locations:
634 - {line: 5, column: 17}
635 - {line: 10, column: 17}
636- name: return types must be unambiguous/disallows differing return type list despite no overlap
637 rule: OverlappingFieldsCanBeMerged
638 schema: 12
639 query: |2-
640
641 {
642 someBox {
643 ... on IntBox {
644 box: stringBox {
645 scalar
646 }
647 }
648 ... on StringBox {
649 box: listStringBox {
650 scalar
651 }
652 }
653 }
654 }
655
656 errors:
657 - message: Fields "box" conflict because they return conflicting types "StringBox" and "[StringBox]". Use different aliases on the fields to fetch both if this was intentional.
658 locations:
659 - {line: 5, column: 17}
660 - {line: 10, column: 17}
661- name: return types must be unambiguous/disallows differing subfields
662 rule: OverlappingFieldsCanBeMerged
663 schema: 12
664 query: |2-
665
666 {
667 someBox {
668 ... on IntBox {
669 box: stringBox {
670 val: scalar
671 val: unrelatedField
672 }
673 }
674 ... on StringBox {
675 box: stringBox {
676 val: scalar
677 }
678 }
679 }
680 }
681
682 errors:
683 - message: Fields "val" conflict because "scalar" and "unrelatedField" are different fields. Use different aliases on the fields to fetch both if this was intentional.
684 locations:
685 - {line: 6, column: 19}
686 - {line: 7, column: 19}
687- name: return types must be unambiguous/disallows differing deep return types despite no overlap
688 rule: OverlappingFieldsCanBeMerged
689 schema: 12
690 query: |2-
691
692 {
693 someBox {
694 ... on IntBox {
695 box: stringBox {
696 scalar
697 }
698 }
699 ... on StringBox {
700 box: intBox {
701 scalar
702 }
703 }
704 }
705 }
706
707 errors:
708 - message: Fields "box" conflict because subfields "scalar" conflict because they return conflicting types "String" and "Int". Use different aliases on the fields to fetch both if this was intentional.
709 locations:
710 - {line: 5, column: 17}
711 - {line: 6, column: 19}
712 - {line: 10, column: 17}
713 - {line: 11, column: 19}
714- name: return types must be unambiguous/allows non-conflicting overlapping types
715 rule: OverlappingFieldsCanBeMerged
716 schema: 12
717 query: |2-
718
719 {
720 someBox {
721 ... on IntBox {
722 scalar: unrelatedField
723 }
724 ... on StringBox {
725 scalar
726 }
727 }
728 }
729
730 errors: []
731- name: return types must be unambiguous/same wrapped scalar return types
732 rule: OverlappingFieldsCanBeMerged
733 schema: 12
734 query: |2-
735
736 {
737 someBox {
738 ...on NonNullStringBox1 {
739 scalar
740 }
741 ...on NonNullStringBox2 {
742 scalar
743 }
744 }
745 }
746
747 errors: []
748- name: return types must be unambiguous/allows inline fragments without type condition
749 rule: OverlappingFieldsCanBeMerged
750 schema: 12
751 query: |2-
752
753 {
754 a
755 ... {
756 a
757 }
758 }
759
760 errors: []
761- name: return types must be unambiguous/compares deep types including list
762 rule: OverlappingFieldsCanBeMerged
763 schema: 12
764 query: |2-
765
766 {
767 connection {
768 ...edgeID
769 edges {
770 node {
771 id: name
772 }
773 }
774 }
775 }
776
777 fragment edgeID on Connection {
778 edges {
779 node {
780 id
781 }
782 }
783 }
784
785 errors:
786 - message: Fields "edges" conflict because subfields "node" conflict because subfields "id" conflict because "name" and "id" are different fields. Use different aliases on the fields to fetch both if this was intentional.
787 locations:
788 - {line: 5, column: 15}
789 - {line: 6, column: 17}
790 - {line: 7, column: 19}
791 - {line: 14, column: 13}
792 - {line: 15, column: 15}
793 - {line: 16, column: 17}
794- name: return types must be unambiguous/ignores unknown types
795 rule: OverlappingFieldsCanBeMerged
796 schema: 12
797 query: |2-
798
799 {
800 someBox {
801 ...on UnknownType {
802 scalar
803 }
804 ...on NonNullStringBox2 {
805 scalar
806 }
807 }
808 }
809
810 errors: []
811- name: return types must be unambiguous/works for field names that are JS keywords
812 rule: OverlappingFieldsCanBeMerged
813 schema: 13
814 query: |2-
815
816 {
817 foo {
818 constructor
819 }
820 }
821
822 errors: []
823- name: does not infinite loop on recursive fragment
824 rule: OverlappingFieldsCanBeMerged
825 schema: 0
826 query: |2-
827
828 {
829 ...fragA
830 }
831
832 fragment fragA on Human { name, relatives { name, ...fragA } }
833
834 errors: []
835- name: does not infinite loop on immediately recursive fragment
836 rule: OverlappingFieldsCanBeMerged
837 schema: 0
838 query: |2-
839
840 {
841 ...fragA
842 }
843
844 fragment fragA on Human { name, ...fragA }
845
846 errors: []
847- name: does not infinite loop on recursive fragment with a field named after fragment
848 rule: OverlappingFieldsCanBeMerged
849 schema: 0
850 query: |2-
851
852 {
853 ...fragA
854 fragA
855 }
856
857 fragment fragA on Query { ...fragA }
858
859 errors: []
860- name: finds invalid cases even with field named after fragment
861 rule: OverlappingFieldsCanBeMerged
862 schema: 0
863 query: |2-
864
865 {
866 fragA
867 ...fragA
868 }
869
870 fragment fragA on Type {
871 fragA: b
872 }
873
874 errors:
875 - message: Fields "fragA" conflict because "fragA" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.
876 locations:
877 - {line: 3, column: 9}
878 - {line: 8, column: 9}
879- name: does not infinite loop on transitively recursive fragment
880 rule: OverlappingFieldsCanBeMerged
881 schema: 0
882 query: |2-
883
884 {
885 ...fragA
886 fragB
887 }
888
889 fragment fragA on Human { name, ...fragB }
890 fragment fragB on Human { name, ...fragC }
891 fragment fragC on Human { name, ...fragA }
892
893 errors: []
894- name: finds invalid case even with immediately recursive fragment
895 rule: OverlappingFieldsCanBeMerged
896 schema: 0
897 query: |2-
898
899 fragment sameAliasesWithDifferentFieldTargets on Dog {
900 ...sameAliasesWithDifferentFieldTargets
901 fido: name
902 fido: nickname
903 }
904
905 errors:
906 - message: Fields "fido" conflict because "name" and "nickname" are different fields. Use different aliases on the fields to fetch both if this was intentional.
907 locations:
908 - {line: 4, column: 9}
909 - {line: 5, column: 9}
View as plain text