@@ -182,22 +182,12 @@ def duplicate_directives_on_sdl_definitions():
182182 SCHEMA | SCALAR | OBJECT | INTERFACE | UNION | INPUT_OBJECT
183183
184184 schema @nonRepeatable @nonRepeatable { query: Dummy }
185- extend schema @nonRepeatable @nonRepeatable
186185
187186 scalar TestScalar @nonRepeatable @nonRepeatable
188- extend scalar TestScalar @nonRepeatable @nonRepeatable
189-
190187 type TestObject @nonRepeatable @nonRepeatable
191- extend type TestObject @nonRepeatable @nonRepeatable
192-
193188 interface TestInterface @nonRepeatable @nonRepeatable
194- extend interface TestInterface @nonRepeatable @nonRepeatable
195-
196189 union TestUnion @nonRepeatable @nonRepeatable
197- extend union TestUnion @nonRepeatable @nonRepeatable
198-
199190 input TestInput @nonRepeatable @nonRepeatable
200- extend input TestInput @nonRepeatable @nonRepeatable
201191 """ ,
202192 [
203193 {
@@ -208,57 +198,136 @@ def duplicate_directives_on_sdl_definitions():
208198 {
209199 "message" : "The directive '@nonRepeatable'"
210200 " can only be used once at this location." ,
211- "locations" : [(6 , 27 ), (6 , 42 )],
201+ "locations" : [(7 , 31 ), (7 , 46 )],
202+ },
203+ {
204+ "message" : "The directive '@nonRepeatable'"
205+ " can only be used once at this location." ,
206+ "locations" : [(8 , 29 ), (8 , 44 )],
212207 },
213208 {
214209 "message" : "The directive '@nonRepeatable'"
215210 " can only be used once at this location." ,
216- "locations" : [(8 , 31 ), (8 , 46 )],
211+ "locations" : [(9 , 37 ), (9 , 52 )],
217212 },
218213 {
219214 "message" : "The directive '@nonRepeatable'"
220215 " can only be used once at this location." ,
221- "locations" : [(9 , 38 ), (9 , 53 )],
216+ "locations" : [(10 , 29 ), (10 , 44 )],
222217 },
223218 {
224219 "message" : "The directive '@nonRepeatable'"
225220 " can only be used once at this location." ,
226221 "locations" : [(11 , 29 ), (11 , 44 )],
227222 },
223+ ],
224+ )
225+
226+ def duplicate_directives_on_sdl_extensions ():
227+ assert_sdl_errors (
228+ """
229+ directive @nonRepeatable on
230+ SCHEMA | SCALAR | OBJECT | INTERFACE | UNION | INPUT_OBJECT
231+
232+ extend schema @nonRepeatable @nonRepeatable
233+
234+ extend scalar TestScalar @nonRepeatable @nonRepeatable
235+ extend type TestObject @nonRepeatable @nonRepeatable
236+ extend interface TestInterface @nonRepeatable @nonRepeatable
237+ extend union TestUnion @nonRepeatable @nonRepeatable
238+ extend input TestInput @nonRepeatable @nonRepeatable
239+ """ ,
240+ [
241+ {
242+ "message" : "The directive '@nonRepeatable'"
243+ " can only be used once at this location." ,
244+ "locations" : [(5 , 27 ), (5 , 42 )],
245+ },
228246 {
229247 "message" : "The directive '@nonRepeatable'"
230248 " can only be used once at this location." ,
231- "locations" : [(12 , 36 ), (12 , 51 )],
249+ "locations" : [(7 , 38 ), (7 , 53 )],
232250 },
233251 {
234252 "message" : "The directive '@nonRepeatable'"
235253 " can only be used once at this location." ,
236- "locations" : [(14 , 37 ), (14 , 52 )],
254+ "locations" : [(8 , 36 ), (8 , 51 )],
237255 },
238256 {
239257 "message" : "The directive '@nonRepeatable'"
240258 " can only be used once at this location." ,
241- "locations" : [(15 , 44 ), (15 , 59 )],
259+ "locations" : [(9 , 44 ), (9 , 59 )],
242260 },
243261 {
244262 "message" : "The directive '@nonRepeatable'"
245263 " can only be used once at this location." ,
246- "locations" : [(17 , 29 ), (17 , 44 )],
264+ "locations" : [(10 , 36 ), (10 , 51 )],
247265 },
248266 {
249267 "message" : "The directive '@nonRepeatable'"
250268 " can only be used once at this location." ,
251- "locations" : [(18 , 36 ), (18 , 51 )],
269+ "locations" : [(11 , 36 ), (11 , 51 )],
252270 },
271+ ],
272+ )
273+
274+ def duplicate_directives_between_sdl_definitions_and_extensions ():
275+ assert_sdl_errors (
276+ """
277+ directive @nonRepeatable on SCHEMA
278+
279+ schema @nonRepeatable { query: Dummy }
280+ extend schema @nonRepeatable
281+ """ ,
282+ [
283+ {
284+ "message" : "The directive '@nonRepeatable'"
285+ " can only be used once at this location." ,
286+ "locations" : [(4 , 20 ), (5 , 27 )],
287+ },
288+ ],
289+ )
290+
291+ assert_sdl_errors (
292+ """
293+ directive @nonRepeatable on SCALAR
294+
295+ scalar TestScalar @nonRepeatable
296+ extend scalar TestScalar @nonRepeatable
297+ scalar TestScalar @nonRepeatable
298+ """ ,
299+ [
300+ {
301+ "message" : "The directive '@nonRepeatable'"
302+ " can only be used once at this location." ,
303+ "locations" : [(4 , 31 ), (5 , 38 )],
304+ },
305+ {
306+ "message" : "The directive '@nonRepeatable'"
307+ " can only be used once at this location." ,
308+ "locations" : [(4 , 31 ), (6 , 31 )],
309+ },
310+ ],
311+ )
312+
313+ assert_sdl_errors (
314+ """
315+ directive @nonRepeatable on OBJECT
316+
317+ extend type TestObject @nonRepeatable
318+ type TestObject @nonRepeatable
319+ extend type TestObject @nonRepeatable
320+ """ ,
321+ [
253322 {
254323 "message" : "The directive '@nonRepeatable'"
255324 " can only be used once at this location." ,
256- "locations" : [(20 , 29 ), (20 , 44 )],
325+ "locations" : [(4 , 36 ), (5 , 29 )],
257326 },
258327 {
259328 "message" : "The directive '@nonRepeatable'"
260329 " can only be used once at this location." ,
261- "locations" : [(21 , 36 ), (21 , 51 )],
330+ "locations" : [(4 , 36 ), (6 , 36 )],
262331 },
263332 ],
264333 )
0 commit comments