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 args
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: allows different args where no conflict is possible
169 rule: OverlappingFieldsCanBeMerged
170 schema: 0
171 query: |2-
172
173 fragment conflictingArgs on Pet {
174 ... on Dog {
175 name(surname: true)
176 }
177 ... on Cat {
178 name
179 }
180 }
181
182 errors: []
183- name: encounters conflict in fragments
184 rule: OverlappingFieldsCanBeMerged
185 schema: 0
186 query: |2-
187
188 {
189 ...A
190 ...B
191 }
192 fragment A on Type {
193 x: a
194 }
195 fragment B on Type {
196 x: b
197 }
198
199 errors:
200 - message: Fields "x" conflict because a and b are different fields. Use different aliases on the fields to fetch both if this was intentional.
201 locations:
202 - {line: 7, column: 9}
203 - {line: 10, column: 9}
204- name: reports each conflict once
205 rule: OverlappingFieldsCanBeMerged
206 schema: 0
207 query: |2-
208
209 {
210 f1 {
211 ...A
212 ...B
213 }
214 f2 {
215 ...B
216 ...A
217 }
218 f3 {
219 ...A
220 ...B
221 x: c
222 }
223 }
224 fragment A on Type {
225 x: a
226 }
227 fragment B on Type {
228 x: b
229 }
230
231 errors:
232 - message: Fields "x" conflict because a and b are different fields. Use different aliases on the fields to fetch both if this was intentional.
233 locations:
234 - {line: 18, column: 9}
235 - {line: 21, column: 9}
236 - message: Fields "x" conflict because c and a are different fields. Use different aliases on the fields to fetch both if this was intentional.
237 locations:
238 - {line: 14, column: 11}
239 - {line: 18, column: 9}
240 - message: Fields "x" conflict because c and b are different fields. Use different aliases on the fields to fetch both if this was intentional.
241 locations:
242 - {line: 14, column: 11}
243 - {line: 21, column: 9}
244- name: deep conflict
245 rule: OverlappingFieldsCanBeMerged
246 schema: 0
247 query: |2-
248
249 {
250 field {
251 x: a
252 },
253 field {
254 x: b
255 }
256 }
257
258 errors:
259 - 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.
260 locations:
261 - {line: 3, column: 9}
262 - {line: 4, column: 11}
263 - {line: 6, column: 9}
264 - {line: 7, column: 11}
265- name: deep conflict with multiple issues
266 rule: OverlappingFieldsCanBeMerged
267 schema: 0
268 query: |2-
269
270 {
271 field {
272 x: a
273 y: c
274 },
275 field {
276 x: b
277 y: d
278 }
279 }
280
281 errors:
282 - 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.
283 locations:
284 - {line: 3, column: 9}
285 - {line: 4, column: 11}
286 - {line: 5, column: 11}
287 - {line: 7, column: 9}
288 - {line: 8, column: 11}
289 - {line: 9, column: 11}
290- name: very deep conflict
291 rule: OverlappingFieldsCanBeMerged
292 schema: 0
293 query: |2-
294
295 {
296 field {
297 deepField {
298 x: a
299 }
300 },
301 field {
302 deepField {
303 x: b
304 }
305 }
306 }
307
308 errors:
309 - 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.
310 locations:
311 - {line: 3, column: 9}
312 - {line: 4, column: 11}
313 - {line: 5, column: 13}
314 - {line: 8, column: 9}
315 - {line: 9, column: 11}
316 - {line: 10, column: 13}
317- name: reports deep conflict to nearest common ancestor
318 rule: OverlappingFieldsCanBeMerged
319 schema: 0
320 query: |2-
321
322 {
323 field {
324 deepField {
325 x: a
326 }
327 deepField {
328 x: b
329 }
330 },
331 field {
332 deepField {
333 y
334 }
335 }
336 }
337
338 errors:
339 - 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.
340 locations:
341 - {line: 4, column: 11}
342 - {line: 5, column: 13}
343 - {line: 7, column: 11}
344 - {line: 8, column: 13}
345- name: reports deep conflict to nearest common ancestor in fragments
346 rule: OverlappingFieldsCanBeMerged
347 schema: 0
348 query: |2-
349
350 {
351 field {
352 ...F
353 }
354 field {
355 ...F
356 }
357 }
358 fragment F on T {
359 deepField {
360 deeperField {
361 x: a
362 }
363 deeperField {
364 x: b
365 }
366 },
367 deepField {
368 deeperField {
369 y
370 }
371 }
372 }
373
374 errors:
375 - 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.
376 locations:
377 - {line: 12, column: 11}
378 - {line: 13, column: 13}
379 - {line: 15, column: 11}
380 - {line: 16, column: 13}
381- name: reports deep conflict in nested fragments
382 rule: OverlappingFieldsCanBeMerged
383 schema: 0
384 query: |2-
385
386 {
387 field {
388 ...F
389 }
390 field {
391 ...I
392 }
393 }
394 fragment F on T {
395 x: a
396 ...G
397 }
398 fragment G on T {
399 y: c
400 }
401 fragment I on T {
402 y: d
403 ...J
404 }
405 fragment J on T {
406 x: b
407 }
408
409 errors:
410 - 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.
411 locations:
412 - {line: 3, column: 9}
413 - {line: 11, column: 9}
414 - {line: 15, column: 9}
415 - {line: 6, column: 9}
416 - {line: 22, column: 9}
417 - {line: 18, column: 9}
418- name: ignores unknown fragments
419 rule: OverlappingFieldsCanBeMerged
420 schema: 0
421 query: |2-
422
423 {
424 field
425 ...Unknown
426 ...Known
427 }
428
429 fragment Known on T {
430 field
431 ...OtherUnknown
432 }
433
434 errors: []
435- name: return types must be unambiguous/conflicting return types which potentially overlap
436 rule: OverlappingFieldsCanBeMerged
437 schema: 1
438 query: |2-
439
440 {
441 someBox {
442 ...on IntBox {
443 scalar
444 }
445 ...on NonNullStringBox1 {
446 scalar
447 }
448 }
449 }
450
451 errors:
452 - 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.
453 locations:
454 - {line: 5, column: 15}
455 - {line: 8, column: 15}
456- name: return types must be unambiguous/compatible return shapes on different return types
457 rule: OverlappingFieldsCanBeMerged
458 schema: 1
459 query: |2-
460
461 {
462 someBox {
463 ... on SomeBox {
464 deepBox {
465 unrelatedField
466 }
467 }
468 ... on StringBox {
469 deepBox {
470 unrelatedField
471 }
472 }
473 }
474 }
475
476 errors: []
477- name: return types must be unambiguous/disallows differing return types despite no overlap
478 rule: OverlappingFieldsCanBeMerged
479 schema: 1
480 query: |2-
481
482 {
483 someBox {
484 ... on IntBox {
485 scalar
486 }
487 ... on StringBox {
488 scalar
489 }
490 }
491 }
492
493 errors:
494 - 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.
495 locations:
496 - {line: 5, column: 15}
497 - {line: 8, column: 15}
498- name: return types must be unambiguous/reports correctly when a non-exclusive follows an exclusive
499 rule: OverlappingFieldsCanBeMerged
500 schema: 1
501 query: |2-
502
503 {
504 someBox {
505 ... on IntBox {
506 deepBox {
507 ...X
508 }
509 }
510 }
511 someBox {
512 ... on StringBox {
513 deepBox {
514 ...Y
515 }
516 }
517 }
518 memoed: someBox {
519 ... on IntBox {
520 deepBox {
521 ...X
522 }
523 }
524 }
525 memoed: someBox {
526 ... on StringBox {
527 deepBox {
528 ...Y
529 }
530 }
531 }
532 other: someBox {
533 ...X
534 }
535 other: someBox {
536 ...Y
537 }
538 }
539 fragment X on SomeBox {
540 scalar
541 }
542 fragment Y on SomeBox {
543 scalar: unrelatedField
544 }
545
546 errors:
547 - 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.
548 locations:
549 - {line: 31, column: 11}
550 - {line: 39, column: 11}
551 - {line: 34, column: 11}
552 - {line: 42, column: 11}
553- name: return types must be unambiguous/disallows differing return type nullability despite no overlap
554 rule: OverlappingFieldsCanBeMerged
555 schema: 1
556 query: |2-
557
558 {
559 someBox {
560 ... on NonNullStringBox1 {
561 scalar
562 }
563 ... on StringBox {
564 scalar
565 }
566 }
567 }
568
569 errors:
570 - 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.
571 locations:
572 - {line: 5, column: 15}
573 - {line: 8, column: 15}
574- name: return types must be unambiguous/disallows differing return type list despite no overlap
575 rule: OverlappingFieldsCanBeMerged
576 schema: 1
577 query: |2-
578
579 {
580 someBox {
581 ... on IntBox {
582 box: listStringBox {
583 scalar
584 }
585 }
586 ... on StringBox {
587 box: stringBox {
588 scalar
589 }
590 }
591 }
592 }
593
594 errors:
595 - 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.'
596 locations:
597 - {line: 5, column: 15}
598 - {line: 10, column: 15}
599- name: return types must be unambiguous/disallows differing return type list despite no overlap
600 rule: OverlappingFieldsCanBeMerged
601 schema: 1
602 query: |2-
603
604 {
605 someBox {
606 ... on IntBox {
607 box: stringBox {
608 scalar
609 }
610 }
611 ... on StringBox {
612 box: listStringBox {
613 scalar
614 }
615 }
616 }
617 }
618
619 errors:
620 - 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.'
621 locations:
622 - {line: 5, column: 15}
623 - {line: 10, column: 15}
624- name: return types must be unambiguous/disallows differing subfields
625 rule: OverlappingFieldsCanBeMerged
626 schema: 1
627 query: |2-
628
629 {
630 someBox {
631 ... on IntBox {
632 box: stringBox {
633 val: scalar
634 val: unrelatedField
635 }
636 }
637 ... on StringBox {
638 box: stringBox {
639 val: scalar
640 }
641 }
642 }
643 }
644
645 errors:
646 - message: Fields "val" conflict because scalar and unrelatedField are different fields. Use different aliases on the fields to fetch both if this was intentional.
647 locations:
648 - {line: 6, column: 17}
649 - {line: 7, column: 17}
650- name: return types must be unambiguous/disallows differing deep return types despite no overlap
651 rule: OverlappingFieldsCanBeMerged
652 schema: 1
653 query: |2-
654
655 {
656 someBox {
657 ... on IntBox {
658 box: stringBox {
659 scalar
660 }
661 }
662 ... on StringBox {
663 box: intBox {
664 scalar
665 }
666 }
667 }
668 }
669
670 errors:
671 - 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.
672 locations:
673 - {line: 5, column: 15}
674 - {line: 6, column: 17}
675 - {line: 10, column: 15}
676 - {line: 11, column: 17}
677- name: return types must be unambiguous/allows non-conflicting overlaping types
678 rule: OverlappingFieldsCanBeMerged
679 schema: 1
680 query: |2-
681
682 {
683 someBox {
684 ... on IntBox {
685 scalar: unrelatedField
686 }
687 ... on StringBox {
688 scalar
689 }
690 }
691 }
692
693 errors: []
694- name: return types must be unambiguous/same wrapped scalar return types
695 rule: OverlappingFieldsCanBeMerged
696 schema: 1
697 query: |2-
698
699 {
700 someBox {
701 ...on NonNullStringBox1 {
702 scalar
703 }
704 ...on NonNullStringBox2 {
705 scalar
706 }
707 }
708 }
709
710 errors: []
711- name: return types must be unambiguous/allows inline typeless fragments
712 rule: OverlappingFieldsCanBeMerged
713 schema: 1
714 query: |2-
715
716 {
717 a
718 ... {
719 a
720 }
721 }
722
723 errors: []
724- name: return types must be unambiguous/compares deep types including list
725 rule: OverlappingFieldsCanBeMerged
726 schema: 1
727 query: |2-
728
729 {
730 connection {
731 ...edgeID
732 edges {
733 node {
734 id: name
735 }
736 }
737 }
738 }
739
740 fragment edgeID on Connection {
741 edges {
742 node {
743 id
744 }
745 }
746 }
747
748 errors:
749 - 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.
750 locations:
751 - {line: 5, column: 13}
752 - {line: 6, column: 15}
753 - {line: 7, column: 17}
754 - {line: 14, column: 11}
755 - {line: 15, column: 13}
756 - {line: 16, column: 15}
757- name: return types must be unambiguous/ignores unknown types
758 rule: OverlappingFieldsCanBeMerged
759 schema: 1
760 query: |2-
761
762 {
763 someBox {
764 ...on UnknownType {
765 scalar
766 }
767 ...on NonNullStringBox2 {
768 scalar
769 }
770 }
771 }
772
773 errors: []
774- name: return types must be unambiguous/works for field names that are JS keywords
775 rule: OverlappingFieldsCanBeMerged
776 schema: 2
777 query: |2-
778
779 foo {
780 constructor
781 }
782 }
783 errors: []
784- name: does not infinite loop on recursive fragment
785 rule: OverlappingFieldsCanBeMerged
786 schema: 0
787 query: |2-
788
789 fragment fragA on Human { name, relatives { name, ...fragA } }
790
791 errors: []
792- name: does not infinite loop on immediately recursive fragment
793 rule: OverlappingFieldsCanBeMerged
794 schema: 0
795 query: |2-
796
797 fragment fragA on Human { name, ...fragA }
798
799 errors: []
800- name: does not infinite loop on transitively recursive fragment
801 rule: OverlappingFieldsCanBeMerged
802 schema: 0
803 query: |2-
804
805 fragment fragA on Human { name, ...fragB }
806 fragment fragB on Human { name, ...fragC }
807 fragment fragC on Human { name, ...fragA }
808
809 errors: []
810- name: finds invalid case even with immediately recursive fragment
811 rule: OverlappingFieldsCanBeMerged
812 schema: 0
813 query: |2-
814
815 fragment sameAliasesWithDifferentFieldTargets on Dog {
816 ...sameAliasesWithDifferentFieldTargets
817 fido: name
818 fido: nickname
819 }
820
821 errors:
822 - message: Fields "fido" conflict because name and nickname are different fields. Use different aliases on the fields to fetch both if this was intentional.
823 locations:
824 - {line: 4, column: 9}
825 - {line: 5, column: 9}
View as plain text