-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathgqlschema_test.yml
3272 lines (3034 loc) · 91.7 KB
/
gqlschema_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
invalid_schemas:
-
name: "More than 1 id field"
input: |
type P {
id1: ID!
id2: ID!
id3: ID!
}
errlist: [
{"message":"Fields id1, id2 and id3 are listed as IDs for type P, but a type can have only one ID field. Pick a single field as the ID for type P.", "locations":[{"line":2, "column":3}, {"line":3, "column":3}, {"line":4, "column":3}]},
{"message":"Type P; is invalid, a type must have atleast one field that is not of ID! type and doesn't have @custom/@lambda directive.", "locations":[{"line":1, "column":6}]}
]
- name: "Geo field with invalid argument in @search."
input: |
type Hotel {
id: ID!
name: String!
location: Point @search(by: [int])
}
errlist: [
{"message":"Type Hotel; Field location: has the @search directive but the argument int doesn't apply to field type Point. Search by int applies to fields of type Int. Fields of type Point are searchable by just @search.", "locations":[ { "line": 4, "column":20}]},
]
-
name: "UID as a field name"
input: |
type P {
uid: String
}
errlist: [
{"message":"Type P; Field uid: uid is a reserved keyword and you cannot declare a field with this name.", "locations": [{"line":2, "column": 3}]},
]
-
name: "Query, Mutation in initial schema"
input: |
type Query {
getAuthor(id: ID): Author!
}
type Mutation {
getAuthor(id: ID): Author!
}
errlist: [
{"message":"GraphQL Query and Mutation types are only allowed to have fields
with @custom/@lambda directive. Other fields are built automatically for you. Found Query getAuthor
without @custom/@lambda.", "locations":[{"line":1, "column":6}]},
{"message":"GraphQL Query and Mutation types are only allowed to have fields with
@custom/@lambda directive. Other fields are built automatically for you. Found Mutation getAuthor
without @custom/@lambda.", "locations":[{"line":4, "column":6}]},
]
-
name: "No ID list of any kind"
input: |
type A {
f: [ID]
name: String
}
errlist: [
{"message": "Type A; Field f: ID lists are invalid.", "locations": [{"line":2, "column": 3}]}
]
-
name: "No nested list of any kind"
input: |
type A {
f: [[String]]
}
errlist: [
{"message": "Type A; Field f: Nested lists are invalid.", "locations": [{"line":2, "column": 3}]}
]
-
name: "Enum indexes clash trigram and regexp"
input: |
type T {
f: E @search(by: [trigram, regexp])
}
enum E {
A
}
errlist: [
{"message": "Type T; Field f: the argument to @search 'trigram' is the same as the index 'regexp' provided before and shouldn't be used together",
"locations": [{"line": 2, "column": 9}]}
]
-
name: "Enum indexes clash hash and exact"
input: |
type T {
f: E @search(by: [hash, exact])
}
enum E {
A
}
errlist: [
{"message": "Type T; Field f: the arguments 'hash' and 'exact' can't be used together as arguments to @search.", "locations": [{"line": 2, "column": 9}]}
]
-
name: "Reference type that is not in input schema"
input: |
type T {
f: Author
}
errlist: [
{"message": "Undefined type Author.", "locations": [{"line": 2, "column": 8}]}
]
-
name: "Unsupported definitions in initial schema"
input: |
scalar Int
interface P {
t: T!
}
union Q = R | S | T
input U {
x: X!
}
errlist: [
{"message":"You can't add scalar definitions. Only type, interface, union, input and enums are allowed in initial schema.", "locations":[{"line":1, "column":8}]}
]
-
name: "union members can't be non-object types - Interface"
input: |
interface I {
f: String
}
union U = I
errlist: [
{"message":"UNION type \"I\" must be OBJECT.", "locations":[{"line":4, "column":7}]}
]
-
name: "union members can't be non-object types - Scalar"
input: |
union U = String
errlist: [
{"message":"UNION type \"String\" must be OBJECT.", "locations":[{"line":1, "column":7}]}
]
-
name: "union members can't be non-object types - Enum"
input: |
enum E {
E1
E2
}
union U = E
errlist: [
{"message":"UNION type \"E\" must be OBJECT.", "locations":[{"line":5, "column":7}]}
]
-
name: "union members can't be non-object types - Input Object"
input: |
input I {
f: String
}
union U = I
errlist: [
{"message":"UNION type \"I\" must be OBJECT.", "locations":[{"line":4, "column":7}]}
]
-
name: "union can't be used with @dgraph(type: ...)"
input: |
type X {
f1: String
}
type Y {
f2: Int
}
union U @dgraph(type: "U") = X | Y
errlist: [
{"message":"Type U; has the @dgraph directive, but it is not applicable on types of UNION kind.", "locations":[{"line":7, "column":10}]}
]
-
name: "union can't be used with @withSubscription"
input: |
type X {
f1: String
}
type Y {
f2: Int
}
union U @withSubscription = X | Y
errlist: [
{ "message": "Type U; has the @withSubscription directive, but it is not applicable on types of UNION kind.", "locations":[{"line":7, "column":10}]}
]
-
name: "union can't be used with @secret"
input: |
type X {
f1: String
}
type Y {
f2: Int
}
union U @secret(field: "f2") = X | Y
errlist: [
{ "message": "Type U; has the @secret directive, but it is not applicable on types of UNION kind.", "locations":[{"line":7, "column":10}]}
]
-
name: "union can't be used with @auth"
input: |
type X {
f1: String
}
type Y {
f2: Int
}
union U @auth(query: {}) = X | Y
errlist: [
{ "message": "Type U; has the @auth directive, but it is not applicable on types of UNION kind.", "locations":[{"line":7, "column":10}]}
]
-
name: "union can't be used with @hasInverse, @search, @id"
input: |
type X {
f1: String
}
type Y {
f2: Int
}
union U = X | Y
type Z {
f: U @hasInverse(field: "f1") @search @id
}
errlist: [
{ "message": "Type Z; Field f: Field f is of type U, but @hasInverse directive only applies to fields with object types.", "locations": [{"line":9, "column":3}]},
{ "message": "Type Z; Field f: has the @search directive but fields of type U can't have the @search directive.", "locations": [{"line":9, "column":34}]},
{ "message": "Type Z; Field f: with @id directive must be of type String!, Int!, Int64! or Float!, not U", "locations": [{"line":9, "column":42}]}
]
-
name: "Typename is reserved word"
input: |
type String {
id: ID!
}
type X {
f: Int
}
union Query = X
interface Mutation {
f: ID!
}
input Subscription {
name: String
}
enum uid {
E1
E2
}
errlist: [
{"message":"String is a reserved word, so you can't declare a type with this name. Pick a different name for the type.", "locations":[{"line":1, "column":6}]},
{"message":"Query is a reserved word, so you can't declare a type with this name. Pick a different name for the type.", "locations":[{"line":7, "column":7}]},
{"message":"Mutation is a reserved word, so you can't declare a type with this name. Pick a different name for the type.", "locations":[{"line":8, "column":11}]},
{"message":"Subscription is a reserved word, so you can't declare a type with this name. Pick a different name for the type.", "locations":[{"line":11, "column":7}]},
{"message":"uid is a reserved word, so you can't declare a type with this name. Pick a different name for the type.", "locations":[{"line":14, "column":6}]},
]
- name: "Point is reserved word"
input: |
type Point {
id: ID!
}
errlist: [
{ "message": "Point is a reserved word, so you can't declare a type with this name. Pick a different name for the type.", "locations": [ { "line": 1, "column": 6 } ] },
]
-
name: "More than 1 errors"
input: |
type X {
i1: ID!
i2: ID!
i3: ID!
l1: [X]!
l2: [ID]
}
errlist: [
{"message":"Fields i1, i2, i3 and l2 are listed as IDs for type X, but a type can have only one ID field. Pick a single field as the ID for type X.", "locations":[{"line":2, "column":3}, {"line":3, "column":3}, {"line":4, "column":3}, {"line":6, "column": 3}]},
{"message": "Type X; Field l2: ID lists are invalid.", "locations": [{"line": 6, "column": 3}]}
]
-
name: "Non linking inverse directive with correct field type"
input: |
type Post {
author: Author! @hasInverse(field: "posts")
likedBy: Author
}
type Author {
posts: [Post!]! @hasInverse(field: likedBy)
}
errlist: [
{"message": "Type Post; Field author: @hasInverse should be consistant. Post.author is the inverse of Author.posts, but Author.posts is the inverse of Post.likedBy.", "locations": [{"line": 2, "column": 20}]}
]
-
name: "Multiple hasInverse to one field"
input: |
type Post {
author: Author! @hasInverse(field: "posts")
likedBy: Author @hasInverse(field: "posts")
}
type Author {
posts: [Post!]!
}
errlist: [
{"message": "Type Post; Field likedBy: @hasInverse should be consistant. Post.likedBy is the inverse of Author.posts, but Author.posts is the inverse of Post.author.", "locations": [{"line": 3, "column": 20}]}
]
-
name: "Non linking inverse directives"
input: |
type X {
f1: P @hasInverse(field: "f1")
f2: String
}
type P {
f1: X @hasInverse(field: "f2")
}
errlist: [
{"message":"Type X; Field f1: @hasInverse should be consistant. X.f1 is the inverse of P.f1, but P.f1 is the inverse of X.f2.", "locations":[{"line":2, "column":10}]},
{"message":"Type P; Field f1: @hasInverse is required to link the fields of same type, but the field f2 is of the type String instead of P. To link these make sure the fields are of the same type.", "locations":[{"line":6, "column":10}]},
]
-
name: "Inverse Directive on non object field"
input: |
type X {
f1: String @hasInverse(field: "f1")
}
errlist: [
{"message":"Type X; Field f1: Field f1 is of type String, but @hasInverse directive only applies to fields with object types.", "locations":[{"line":2, "column":3}]},
]
-
name: "Inverse Directive doesn't have field argument"
input: |
type X {
f1: X @hasInverse
}
errlist: [
{"message":"Type X; Field f1: @hasInverse directive doesn't have field argument.", "locations":[{"line":2, "column":10}]},
]
-
name: "hasInverse on non existing field"
input: |
type X {
f1: [P!]! @hasInverse(field: "f2")
}
type P {
f1: String
}
errlist: [
{"message":"Type X; Field f1: inverse field f2 doesn't exist for type P.", "locations":[{"line":2, "column":14}]},
]
-
name: "ID can't have the @search directive"
input: |
type X {
id: ID! @search
name: String
}
type Y {
id: ID! @search(by: [term])
name: String
}
errlist: [
{"message": "Type X; Field id: has the @search directive but fields of type ID can't
have the @search directive.",
"locations":[{"line":2, "column":12}]},
{"message": "Type Y; Field id: has the @search directive but the argument term doesn't
apply to field type ID. Search by term applies to fields of type String. Fields of type
ID can't have the @search directive.",
"locations":[{"line":6, "column":12}]}
]
-
name: "Search will error on type that can't have the @search"
input: |
type X {
y: Y @search
}
type Y {
y: String
}
errlist: [
{"message": "Type X; Field y: has the @search directive but fields of type Y
can't have the @search directive.",
"locations":[{"line":2, "column":9}]}
]
-
name: "Search (with arg) will error that can't have the @search"
input: |
type X {
y: Y @search(by: [term])
}
type Y {
y: String
}
errlist: [
{"message": "Type X; Field y: has the @search directive but the argument term doesn't
apply to field type Y. Search by term applies to fields of type String. Fields of
type Y can't have the @search directive.",
"locations":[{"line":2, "column":9}]}
]
-
name: "Search with wrong arg with error on default search type"
input: |
type X {
y: Int @search(by: [term])
}
errlist: [
{"message": "Type X; Field y: has the @search directive but the argument term doesn't
apply to field type Int. Search by term applies to fields of type String. Fields of
type Int are searchable by just @search.",
"locations":[{"line":2, "column":11}]}
]
-
name: "Search with wrong arg (int) with error on default search type (Int64)"
input: |
type X {
y: Int64 @search(by: [int])
}
errlist: [
{"message": "Type X; Field y: has the @search directive but the argument int doesn't
apply to field type Int64. Search by int applies to fields of type Int. Fields of
type Int64 are searchable by just @search.",
"locations":[{"line":2, "column":13}]}
]
-
name: "Search with wrong arg with error on search type"
input: |
type X {
y: String @search(by: [day])
}
errlist: [
{"message": "Type X; Field y: has the @search directive but the argument day doesn't
apply to field type String. Search by day applies to fields of type DateTime. Fields
of type String can have @search by exact, fulltext, hash, regexp, term and trigram.",
"locations":[{"line":2, "column":14}]}
]
-
name: "Search with wrong arg for the index"
input: |
type X {
y: String @search(by: [hash, hour])
}
errlist: [
{"message": "Type X; Field y: has the @search directive but the argument hour doesn't
apply to field type String. Search by hour applies to fields of type DateTime. Fields
of type String can have @search by exact, fulltext, hash, regexp, term and trigram.",
"locations":[{"line":2, "column":14}]}
]
-
name: "Search without []"
input: |
type X {
y: String @search(by: hash)
}
errlist: [
{"message": "Type X; Field y: the @search directive requires a list argument,
like @search(by: [hash])",
"locations":[{"line":2, "column":14}]}
]
-
name: "Search doesn't allow hash and exact together"
input: |
type X {
y: String @search(by: [hash, exact])
}
errlist: [
{"message": "Type X; Field y: the arguments 'hash' and 'exact' can't be
used together as arguments to @search.",
"locations":[{"line":2, "column":14}]}
]
-
name: "Search with multiple datetime index"
input: |
type X {
y: DateTime @search(by: [hour, month])
}
errlist: [
{"message": "Type X; Field y: has the search directive on DateTime. DateTime
allows only one argument for @search.",
"locations":[{"line":2, "column":16}]}
]
-
name: "Search doesn't allow trigram and regexp together"
input: |
type X {
y: String @search(by: [trigram, regexp])
}
errlist: [
{"message": "Type X; Field y: the argument to @search 'trigram' is the same as
the index 'regexp' provided before and shouldn't be used together",
"locations":[{"line":2, "column":14}]}
]
-
name: "Search doesn't accept bogus args"
input: |
type X {
y: String @search(by: [bogus])
}
errlist: [
{"message": "Type X; Field y: the argument to @search bogus isn't valid.Fields of type
String can have @search by exact, fulltext, hash, regexp, term and trigram.",
"locations":[{"line":2, "column":14}]}
]
-
name: "Type implements an interface which wasn't defined"
input: |
type X implements Y {
y: String
}
errlist: [
{"message": Undefined type "Y".,
"locations":[{"line":1, "column":6}]}
]
-
name: "Type implements an interface with the field name repeated but different type"
input: |
interface Y {
id: ID
}
type X implements Y {
id: String
y: String
}
errlist: [
{"message": "For type X to implement interface Y the field id must have type ID",
"locations":[{"line":4, "column":6}]}
]
-
name: "Type implements an interface with no field of its own"
input: |
interface Y {
id: ID
}
type X implements Y {
}
errlist: [
{"message": "expected at least one definition, found }",
"locations":[{"line":5, "column":1}]}
]
-
name: "Type implements from two interfaces where both have ID with different type"
input: |
interface X {
id: ID!
}
interface Y {
id: ID
}
type Z implements X & Y {
name: String
}
errlist: [
{"message": "field id is of type ID in interface Y and is of type ID! in interface X",
"locations":[{"line":7, "column":6}]}
]
-
name: "List of Boolean is not allowed"
input: |
type X {
q: [Boolean]
}
errlist: [
{"message": "Type X; Field q: Boolean lists are invalid.",
"locations":[{"line":2, "column":3}]}
]
-
name: "ID field can't have @dgraph directive"
input: |
type X {
id: ID @dgraph(pred: "X.id")
name: String
}
errlist: [
{"message": "Type X; Field id: has the @dgraph directive but fields of type ID can't
have the @dgraph directive.",
"locations":[{"line":2, "column":11}]}
]
-
name: "Field with @id directive has wrong type"
input: |
type X {
f1: [String] @id
}
errlist: [
{"message": "Type X; Field f1: with @id directive must be of type String!, Int!, Int64! or Float!, not [String]",
"locations":[{"line":2, "column":17}]}
]
-
name: "Field with @id directive should be mandatory"
input: |
type X {
f1: String @id
}
errlist: [
{"message": "Type X; Field f1: with @id directive must be of type String!, Int!, Int64! or Float!, not String",
"locations":[{"line":2, "column":15}]}
]
-
name: "Dgraph directive with wrong argument produces an error"
input: |
type X {
f1: String! @dgraph(type: "f1")
}
errlist: [
{"message": "Type X; Field f1: pred argument for @dgraph directive should
not be empty.",
"locations":[{"line":2, "column":16}]}
]
-
name: "Dgraph directive with no argument on field produces an error"
input: |
type X {
f1: String! @dgraph
}
errlist: [
{"message": "Type X; Field f1: pred argument for @dgraph directive should
not be empty.",
"locations":[{"line":2, "column":16}]}
]
-
name: "Dgraph directive with wrong argument type on field produces an error"
input: |
type X {
f1: String! @dgraph(pred: 2)
}
errlist: [
{"message": "Type X; Field f1: pred argument for @dgraph directive should be of type String.",
"locations":[{"line":2, "column":16}]}
]
-
name: "Dgraph directive with wrong argument on type produces an error"
input: |
type X @dgraph(pred: "X") {
f1: String!
}
errlist: [
{"message": "Type X; type argument for @dgraph directive should not be empty.",
"locations":[{"line":1, "column":9}]}
]
-
name: "Dgraph directive with no argument on type produces an error"
input: |
type X @dgraph {
f1: String!
}
errlist: [
{"message": "Type X; type argument for @dgraph directive should not be empty.",
"locations":[{"line":1, "column":9}]}
]
-
name: "Dgraph directive with wrong argument type on type produces an error"
input: |
type X @dgraph(type: 2) {
f1: String!
}
errlist: [
{"message": "Type X; type argument for @dgraph directive should of type String.",
"locations":[{"line":1, "column":9}]}
]
-
name: "Dgraph directive with reverse pred argument on scalar field produces an error"
input: |
type X {
f1: String! @dgraph(pred:"~movie")
f2: String! @dgraph(pred:"<~movie>")
}
errlist: [
{"message": "Type X; Field f1 is of type String, but reverse predicate in @dgraph directive
only applies to fields with object types.",
"locations":[{"line":2, "column":3}]},
{"message": "Type X; Field f2 is of type String, but reverse predicate in @dgraph directive
only applies to fields with object types.",
"locations":[{"line":3, "column":3}]}
]
-
name: "Dgraph directive with reverse pred argument on field without a corresponding reverse field is an error"
input: |
type Y {
g1: String!
}
type X {
f1: [Y!] @dgraph(pred:"~movie")
}
errlist: [
{"message": "Type X; Field f1: pred argument: ~movie is not supported as forward edge doesn't exist for type Y.",
"locations":[{"line":6, "column":13}]}
]
-
name: "Dgraph directive with reverse pred argument along with hasInverse produces an error"
input: |
type X {
f1: [Y] @dgraph(pred: "f1")
}
type Y {
f1: [X] @dgraph(pred: "~f1") @hasInverse(field: "f1")
}
errlist: [
{"message": "Type Y; Field f1: @hasInverse directive is not allowed when pred argument in
@dgraph directive starts with a ~.",
"locations":[{"line":5, "column":12}]}
]
-
name: "Dgraph directive with reverse pred argument along with hasInverse in forward direction
produces an error"
input: |
type X {
f1: [Y] @dgraph(pred: "f1") @hasInverse(field: "f1")
}
type Y {
f1: [X] @dgraph(pred: "~f1")
}
errlist: [
{"message": "Type Y; Field f1: @hasInverse directive is not allowed when pred argument in
@dgraph directive starts with a ~.",
"locations":[{"line":5, "column":12}]}
]
-
name: "Dgraph directive with reverse pred argument matching with wrong type produces an error"
input: |
type Z {
f1: String!
}
type X {
f1: [Z] @dgraph(pred: "f1")
}
type Y {
f1: [X] @dgraph(pred: "~f1")
}
errlist: [
{"message": "Type X; Field f1: should be of type Y to be compatible with @dgraph reverse
directive but is of type Z.",
"locations":[{"line":5, "column":12}]}
]
-
name: "Dgraph directive with reverse pred argument matching with wrong type implementing an interface produces an error"
input: |
type Z {
f1: String!
}
type X {
f1: [Z] @dgraph(pred: "f1")
}
interface Person {
id: ID!
}
type Y implements Person {
f1: [X] @dgraph(pred: "~f1")
}
errlist: [
{"message": "Type X; Field f1: should be any of types Y or Person to be compatible with @dgraph reverse
directive but is of type Z.",
"locations":[{"line":5, "column":12}]}
]
-
name: "Dgraph directive with reverse pred argument matching with wrong type implementing multiple interfaces produces an error"
input: |
type Z {
f1: String!
}
type X {
f1: [Z] @dgraph(pred: "f1")
}
interface Person {
id: ID!
}
interface Student {
ids: String! @id
}
type Y implements Person & Student {
f1: [X] @dgraph(pred: "~f1")
}
errlist: [
{"message": "Type X; Field f1: should be any of types Y, Person or Student to be compatible with @dgraph reverse
directive but is of type Z.",
"locations":[{"line":5, "column":12}]}
]
-
name: "Field with a dgraph directive with reverse pred argument should be a list"
input: |
type X {
f1: [Y] @dgraph(pred: "f1")
}
type Y {
f1: X @dgraph(pred: "~f1")
}
errlist: [
{"message": "Type Y; Field f1: with a dgraph directive that starts with ~ should be of type
list.",
"locations":[{"line":5, "column":10}]}
]
-
name: "Empty field in secret directive"
input: |
type X @secret(field:""){
f1: String!
}
errlist: [
{"message": "Type X; Argument \"field\" of secret directive is empty",
"locations":[{"line":1, "column":6}]},
]
-
name: "Multiple secret directive"
input: |
type X @secret(field:"password") @secret(field: "psss"){
f1: String!
}
errlist: [
{"message": "Type X; has more than one secret fields password,psss",
"locations":[{"line":1, "column":6}]},
]
- name: "Conflicting secret directive and field"
input: |
type X @secret(field:"f1"){
f1: String!
}
errlist: [
{"message": "Type X; has a secret directive and field of the same name f1",
"locations":[{"line":1, "column":6}]},
]
-
name: "@dgraph(pred: ...) validation"
input: |
interface V {
f1: String @dgraph(pred: "ff1")
}
interface W @secret(field: "f", pred: "pwd") {
f2: String! @dgraph(pred: "name")
f3: [Float] @dgraph(pred: "val")
f4: String @dgraph(pred: "ff4")
f5: String @dgraph(pred: "ff1")
}
type X implements V & W {
f6: Y @dgraph(pred: "link")
f7: String! @dgraph(pred: "ff7") @id
f8: String
f9: String @dgraph(pred: "ff4")
}
type Y {
f2: Int @dgraph(pred: "name")
f3: Float @dgraph(pred: "val")
f6: X @dgraph(pred: "link")
f7: String @dgraph(pred: "ff7")
f8: Int @dgraph(pred: "X.f8")
f10: String @dgraph(pred: "pwd")
}
errlist: [
{"message": "Type X; implements interfaces [V W], all of which have fields with @dgraph predicate: ff1. These fields must use different Dgraph predicates.",
"locations":[{"line":10, "column":6}]},
{"message": "Type X; Field f9: has the @dgraph directive, which conflicts with interface W; field f4, that this type implements. These fields must use different Dgraph predicates.",
"locations":[{"line":14, "column":3}]},
{"message": "Type Y; Field f2: has type Int, which is different to type W; field f2, which has the same @dgraph directive but type String. These fields must have either the same GraphQL types, or use different Dgraph predicates.",
"locations":[{"line":17, "column":3}]},
{"message": "Type Y; Field f3: has type Float, which is different to type W; field f3, which has the same @dgraph directive but type [Float]. These fields must have either the same GraphQL types, or use different Dgraph predicates.",
"locations":[{"line":18, "column":3}]},
{"message": "Type Y; Field f6: has type X, which is different to type X; field f6, which has the same @dgraph directive but type Y. These fields must have either the same GraphQL types, or use different Dgraph predicates.",
"locations":[{"line":19, "column":3}]},
{"message": "Type Y; Field f7: doesn't have @id directive, which conflicts with type X; field f7, which has the same @dgraph directive along with @id directive. Both these fields must either use @id directive, or use different Dgraph predicates.",
"locations":[{"line":20, "column":3}]},
{"message": "Type Y; Field f8: has type Int, which is different to type X; field f8, which has the same @dgraph directive but type String. These fields must have either the same GraphQL types, or use different Dgraph predicates.",
"locations":[{"line":21, "column":3}]},
{"message": "Type Y; Field f10: has the @dgraph predicate, but that conflicts with type W @secret directive on the same predicate. @secret predicates are stored encrypted and so the same predicate can't be used as a String.",
"locations":[{"line":22, "column":3}]}]
- name: "user-defined types can't have same name as the types generated for other user-defined types or any inbuilt types"
input: |
type Author {
id: ID!
name: String
}
input UpdateAuthorInput {
id: ID!
name: String
}
union U = Author
input URef {
id: ID!
}
type IntFilter {
name: String
}
errlist: [
{"message": "UpdateAuthorInput is a reserved word, so you can't declare a INPUT_OBJECT with this name. Pick a different name for the INPUT_OBJECT.", "locations":[{"line":5, "column":7}]},
{"message": "URef is a reserved word, so you can't declare a INPUT_OBJECT with this name. Pick a different name for the INPUT_OBJECT.", "locations":[{"line":10, "column":7}]},
{"message": "IntFilter is a reserved word, so you can't declare a OBJECT with this name. Pick a different name for the OBJECT.", "locations":[{"line":13, "column":6}]},
]
- name: "@custom query can't have same name as the query generated for other types"
input: |
type Author {
id: ID!
name: String
}
type Query {
getAuthor(id: ID): Author! @custom(http: {url: "http://blah.com", method: "GET"})
}
errlist: [
{"message": "getAuthor is a reserved word, so you can't declare a query with this name. Pick a different name for the query.",
"locations":[{"line":7, "column":3}]},
]
- name: "@custom mutation can't have same name as the mutation generated for other types"
input: |
type Author {
id: ID!
name: String
}
type Mutation {
addAuthor(id: ID): Author! @custom(http: {url: "http://blah.com", method: "GET"})
}
errlist: [
{"message": "addAuthor is a reserved word, so you can't declare a mutation with this name. Pick a different name for the mutation.",
"locations":[{"line":7, "column":3}]},
]
- name: "@custom directive with extra arguments"
input: |
type Author {
id: ID!
name: String
}
type Query {
getAuthor1(id: ID): Author! @custom(http: {url: "blah.com", method: "GET"}, extra: "random")
}
errlist: [
{"message": "Type Query; Field getAuthor1: has 2 arguments for @custom directive, it should contain exactly one of `http` or `dql` arguments.",
"locations":[{"line":7, "column":32}]},
{"message" : "Type Query; Field getAuthor1; url field inside @custom directive is invalid.", "locations" : [{"line":7, "column":52}]}
]
- name: "@custom directive without http or dql argument"
input: |