...
1- name: all fragment names are used
2 rule: NoUnusedFragments
3 schema: 0
4 query: |2-
5
6 {
7 human(id: 4) {
8 ...HumanFields1
9 ... on Human {
10 ...HumanFields2
11 }
12 }
13 }
14 fragment HumanFields1 on Human {
15 name
16 ...HumanFields3
17 }
18 fragment HumanFields2 on Human {
19 name
20 }
21 fragment HumanFields3 on Human {
22 name
23 }
24
25 errors: []
26- name: all fragment names are used by multiple operations
27 rule: NoUnusedFragments
28 schema: 0
29 query: |2-
30
31 query Foo {
32 human(id: 4) {
33 ...HumanFields1
34 }
35 }
36 query Bar {
37 human(id: 4) {
38 ...HumanFields2
39 }
40 }
41 fragment HumanFields1 on Human {
42 name
43 ...HumanFields3
44 }
45 fragment HumanFields2 on Human {
46 name
47 }
48 fragment HumanFields3 on Human {
49 name
50 }
51
52 errors: []
53- name: contains unknown fragments
54 rule: NoUnusedFragments
55 schema: 0
56 query: |2-
57
58 query Foo {
59 human(id: 4) {
60 ...HumanFields1
61 }
62 }
63 query Bar {
64 human(id: 4) {
65 ...HumanFields2
66 }
67 }
68 fragment HumanFields1 on Human {
69 name
70 ...HumanFields3
71 }
72 fragment HumanFields2 on Human {
73 name
74 }
75 fragment HumanFields3 on Human {
76 name
77 }
78 fragment Unused1 on Human {
79 name
80 }
81 fragment Unused2 on Human {
82 name
83 }
84
85 errors:
86 - message: Fragment "Unused1" is never used.
87 locations:
88 - {line: 22, column: 7}
89 - message: Fragment "Unused2" is never used.
90 locations:
91 - {line: 25, column: 7}
92- name: contains unknown fragments with ref cycle
93 rule: NoUnusedFragments
94 schema: 0
95 query: |2-
96
97 query Foo {
98 human(id: 4) {
99 ...HumanFields1
100 }
101 }
102 query Bar {
103 human(id: 4) {
104 ...HumanFields2
105 }
106 }
107 fragment HumanFields1 on Human {
108 name
109 ...HumanFields3
110 }
111 fragment HumanFields2 on Human {
112 name
113 }
114 fragment HumanFields3 on Human {
115 name
116 }
117 fragment Unused1 on Human {
118 name
119 ...Unused2
120 }
121 fragment Unused2 on Human {
122 name
123 ...Unused1
124 }
125
126 errors:
127 - message: Fragment "Unused1" is never used.
128 locations:
129 - {line: 22, column: 7}
130 - message: Fragment "Unused2" is never used.
131 locations:
132 - {line: 26, column: 7}
133- name: contains unknown and undef fragments
134 rule: NoUnusedFragments
135 schema: 0
136 query: |2-
137
138 query Foo {
139 human(id: 4) {
140 ...bar
141 }
142 }
143 fragment foo on Human {
144 name
145 }
146
147 errors:
148 - message: Fragment "foo" is never used.
149 locations:
150 - {line: 7, column: 7}
View as plain text