@@ -182,22 +182,12 @@ def duplicate_directives_on_sdl_definitions():
182
182
SCHEMA | SCALAR | OBJECT | INTERFACE | UNION | INPUT_OBJECT
183
183
184
184
schema @nonRepeatable @nonRepeatable { query: Dummy }
185
- extend schema @nonRepeatable @nonRepeatable
186
185
187
186
scalar TestScalar @nonRepeatable @nonRepeatable
188
- extend scalar TestScalar @nonRepeatable @nonRepeatable
189
-
190
187
type TestObject @nonRepeatable @nonRepeatable
191
- extend type TestObject @nonRepeatable @nonRepeatable
192
-
193
188
interface TestInterface @nonRepeatable @nonRepeatable
194
- extend interface TestInterface @nonRepeatable @nonRepeatable
195
-
196
189
union TestUnion @nonRepeatable @nonRepeatable
197
- extend union TestUnion @nonRepeatable @nonRepeatable
198
-
199
190
input TestInput @nonRepeatable @nonRepeatable
200
- extend input TestInput @nonRepeatable @nonRepeatable
201
191
""" ,
202
192
[
203
193
{
@@ -208,57 +198,136 @@ def duplicate_directives_on_sdl_definitions():
208
198
{
209
199
"message" : "The directive '@nonRepeatable'"
210
200
" 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 )],
212
207
},
213
208
{
214
209
"message" : "The directive '@nonRepeatable'"
215
210
" can only be used once at this location." ,
216
- "locations" : [(8 , 31 ), (8 , 46 )],
211
+ "locations" : [(9 , 37 ), (9 , 52 )],
217
212
},
218
213
{
219
214
"message" : "The directive '@nonRepeatable'"
220
215
" can only be used once at this location." ,
221
- "locations" : [(9 , 38 ), (9 , 53 )],
216
+ "locations" : [(10 , 29 ), (10 , 44 )],
222
217
},
223
218
{
224
219
"message" : "The directive '@nonRepeatable'"
225
220
" can only be used once at this location." ,
226
221
"locations" : [(11 , 29 ), (11 , 44 )],
227
222
},
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
+ },
228
246
{
229
247
"message" : "The directive '@nonRepeatable'"
230
248
" can only be used once at this location." ,
231
- "locations" : [(12 , 36 ), (12 , 51 )],
249
+ "locations" : [(7 , 38 ), (7 , 53 )],
232
250
},
233
251
{
234
252
"message" : "The directive '@nonRepeatable'"
235
253
" can only be used once at this location." ,
236
- "locations" : [(14 , 37 ), (14 , 52 )],
254
+ "locations" : [(8 , 36 ), (8 , 51 )],
237
255
},
238
256
{
239
257
"message" : "The directive '@nonRepeatable'"
240
258
" can only be used once at this location." ,
241
- "locations" : [(15 , 44 ), (15 , 59 )],
259
+ "locations" : [(9 , 44 ), (9 , 59 )],
242
260
},
243
261
{
244
262
"message" : "The directive '@nonRepeatable'"
245
263
" can only be used once at this location." ,
246
- "locations" : [(17 , 29 ), (17 , 44 )],
264
+ "locations" : [(10 , 36 ), (10 , 51 )],
247
265
},
248
266
{
249
267
"message" : "The directive '@nonRepeatable'"
250
268
" can only be used once at this location." ,
251
- "locations" : [(18 , 36 ), (18 , 51 )],
269
+ "locations" : [(11 , 36 ), (11 , 51 )],
252
270
},
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
+ [
253
322
{
254
323
"message" : "The directive '@nonRepeatable'"
255
324
" can only be used once at this location." ,
256
- "locations" : [(20 , 29 ), (20 , 44 )],
325
+ "locations" : [(4 , 36 ), (5 , 29 )],
257
326
},
258
327
{
259
328
"message" : "The directive '@nonRepeatable'"
260
329
" can only be used once at this location." ,
261
- "locations" : [(21 , 36 ), (21 , 51 )],
330
+ "locations" : [(4 , 36 ), (6 , 36 )],
262
331
},
263
332
],
264
333
)
0 commit comments