1
1
use crate :: {
2
- GraphQLError :: ValidationError ,
3
2
GraphQLInputObject , GraphQLScalar , InputValue , ScalarValue , Value ,
4
3
executor:: Variables ,
5
4
graphql_object, graphql_value, graphql_vars,
@@ -281,10 +280,11 @@ async fn variable_error_on_nested_non_null() {
281
280
282
281
assert_eq ! (
283
282
error,
284
- ValidationError ( vec! [ RuleError :: new(
283
+ RuleError :: new(
285
284
r#"Variable "$input" got invalid value. In field "c": Expected "String!", found null."# ,
286
285
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
287
- ) ] ) ,
286
+ )
287
+ . into( ) ,
288
288
) ;
289
289
}
290
290
@@ -305,10 +305,10 @@ async fn variable_error_on_incorrect_type() {
305
305
306
306
assert_eq ! (
307
307
error,
308
- ValidationError ( vec! [ RuleError :: new(
308
+ RuleError :: new(
309
309
r#"Variable "$input" got invalid value. Expected "TestInputObject", found not an object."# ,
310
310
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
311
- ) ] ) ,
311
+ ) . into ( ) ,
312
312
) ;
313
313
}
314
314
@@ -334,10 +334,11 @@ async fn variable_error_on_omit_non_null() {
334
334
335
335
assert_eq ! (
336
336
error,
337
- ValidationError ( vec! [ RuleError :: new(
337
+ RuleError :: new(
338
338
r#"Variable "$input" got invalid value. In field "c": Expected "String!", found null."# ,
339
339
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
340
- ) ] ) ,
340
+ )
341
+ . into( ) ,
341
342
) ;
342
343
}
343
344
@@ -363,7 +364,7 @@ async fn variable_multiple_errors_with_nesting() {
363
364
364
365
assert_eq ! (
365
366
error,
366
- ValidationError ( vec![
367
+ vec![
367
368
RuleError :: new(
368
369
r#"Variable "$input" got invalid value. In field "na": In field "c": Expected "String!", found null."# ,
369
370
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
@@ -372,7 +373,7 @@ async fn variable_multiple_errors_with_nesting() {
372
373
r#"Variable "$input" got invalid value. In field "nb": Expected "String!", found null."# ,
373
374
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
374
375
) ,
375
- ] ) ,
376
+ ] . into ( ) ,
376
377
) ;
377
378
}
378
379
@@ -400,10 +401,11 @@ async fn variable_error_on_additional_field() {
400
401
401
402
assert_eq ! (
402
403
error,
403
- ValidationError ( vec! [ RuleError :: new(
404
+ RuleError :: new(
404
405
r#"Variable "$input" got invalid value. In field "extra": Unknown field."# ,
405
406
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
406
- ) ] ) ,
407
+ )
408
+ . into( ) ,
407
409
) ;
408
410
}
409
411
@@ -510,10 +512,11 @@ async fn does_not_allow_non_nullable_input_to_be_omitted_in_variable() {
510
512
511
513
assert_eq ! (
512
514
error,
513
- ValidationError ( vec! [ RuleError :: new(
515
+ RuleError :: new(
514
516
r#"Variable "$value" of required type "String!" was not provided."# ,
515
517
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
516
- ) ] ) ,
518
+ )
519
+ . into( ) ,
517
520
) ;
518
521
}
519
522
@@ -534,10 +537,11 @@ async fn does_not_allow_non_nullable_input_to_be_set_to_null_in_variable() {
534
537
535
538
assert_eq ! (
536
539
error,
537
- ValidationError ( vec! [ RuleError :: new(
540
+ RuleError :: new(
538
541
r#"Variable "$value" of required type "String!" was not provided."# ,
539
542
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
540
- ) ] ) ,
543
+ )
544
+ . into( ) ,
541
545
) ;
542
546
}
543
547
@@ -632,10 +636,11 @@ async fn does_not_allow_non_null_lists_to_be_null() {
632
636
633
637
assert_eq ! (
634
638
error,
635
- ValidationError ( vec! [ RuleError :: new(
639
+ RuleError :: new(
636
640
r#"Variable "$input" of required type "[String]!" was not provided."# ,
637
641
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
638
- ) ] ) ,
642
+ )
643
+ . into( ) ,
639
644
) ;
640
645
}
641
646
@@ -715,10 +720,10 @@ async fn does_not_allow_lists_of_non_null_to_contain_null() {
715
720
716
721
assert_eq ! (
717
722
error,
718
- ValidationError ( vec! [ RuleError :: new(
723
+ RuleError :: new(
719
724
r#"Variable "$input" got invalid value. In element #1: Expected "String!", found null."# ,
720
725
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
721
- ) ] ) ,
726
+ ) . into ( ) ,
722
727
) ;
723
728
}
724
729
@@ -739,10 +744,10 @@ async fn does_not_allow_non_null_lists_of_non_null_to_contain_null() {
739
744
740
745
assert_eq ! (
741
746
error,
742
- ValidationError ( vec! [ RuleError :: new(
747
+ RuleError :: new(
743
748
r#"Variable "$input" got invalid value. In element #1: Expected "String!", found null."# ,
744
749
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
745
- ) ] ) ,
750
+ ) . into ( ) ,
746
751
) ;
747
752
}
748
753
@@ -763,10 +768,11 @@ async fn does_not_allow_non_null_lists_of_non_null_to_be_null() {
763
768
764
769
assert_eq ! (
765
770
error,
766
- ValidationError ( vec! [ RuleError :: new(
771
+ RuleError :: new(
767
772
r#"Variable "$input" of required type "[String!]!" was not provided."# ,
768
773
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
769
- ) ] ) ,
774
+ )
775
+ . into( ) ,
770
776
) ;
771
777
}
772
778
@@ -915,11 +921,12 @@ async fn does_not_allow_missing_required_field() {
915
921
916
922
assert_eq ! (
917
923
error,
918
- ValidationError ( vec! [ RuleError :: new(
924
+ RuleError :: new(
919
925
"Invalid value for argument \" arg\" , \
920
926
reason: \" ExampleInputObject\" is missing fields: \" b\" ",
921
927
& [ SourcePosition :: new( 20 , 0 , 20 ) ] ,
922
- ) ] ) ,
928
+ )
929
+ . into( ) ,
923
930
) ;
924
931
}
925
932
@@ -940,12 +947,13 @@ async fn does_not_allow_null_in_required_field() {
940
947
941
948
assert_eq ! (
942
949
error,
943
- ValidationError ( vec! [ RuleError :: new(
950
+ RuleError :: new(
944
951
"Invalid value for argument \" arg\" , \
945
952
reason: Error on \" ExampleInputObject\" field \" b\" : \
946
953
\" null\" specified for not nullable type \" Int!\" ",
947
954
& [ SourcePosition :: new( 20 , 0 , 20 ) ] ,
948
- ) ] ) ,
955
+ )
956
+ . into( ) ,
949
957
) ;
950
958
}
951
959
@@ -966,10 +974,11 @@ async fn does_not_allow_missing_variable_for_required_field() {
966
974
967
975
assert_eq ! (
968
976
error,
969
- ValidationError ( vec! [ RuleError :: new(
977
+ RuleError :: new(
970
978
r#"Variable "$var" of required type "Int!" was not provided."# ,
971
979
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
972
- ) ] ) ,
980
+ )
981
+ . into( ) ,
973
982
) ;
974
983
}
975
984
@@ -990,10 +999,11 @@ async fn does_not_allow_null_variable_for_required_field() {
990
999
991
1000
assert_eq ! (
992
1001
error,
993
- ValidationError ( vec! [ RuleError :: new(
1002
+ RuleError :: new(
994
1003
r#"Variable "$var" of required type "Int!" was not provided."# ,
995
1004
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
996
- ) ] ) ,
1005
+ )
1006
+ . into( ) ,
997
1007
) ;
998
1008
}
999
1009
@@ -1091,11 +1101,12 @@ mod integers {
1091
1101
1092
1102
assert_eq ! (
1093
1103
error,
1094
- ValidationError ( vec! [ RuleError :: new(
1104
+ RuleError :: new(
1095
1105
"Variable \" $var\" got invalid value. Expected input scalar `Int`. \
1096
1106
Got: `10`. Details: Expected `Int`, found: 10.",
1097
1107
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
1098
- ) ] ) ,
1108
+ )
1109
+ . into( ) ,
1099
1110
) ;
1100
1111
}
1101
1112
@@ -1116,12 +1127,13 @@ mod integers {
1116
1127
1117
1128
assert_eq ! (
1118
1129
error,
1119
- ValidationError ( vec! [ RuleError :: new(
1130
+ RuleError :: new(
1120
1131
"Variable \" $var\" got invalid value. \
1121
1132
Expected input scalar `Int`. Got: `\" 10\" `. \
1122
1133
Details: Expected `Int`, found: \" 10\" .",
1123
1134
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
1124
- ) ] ) ,
1135
+ )
1136
+ . into( ) ,
1125
1137
) ;
1126
1138
}
1127
1139
}
@@ -1176,12 +1188,13 @@ mod floats {
1176
1188
1177
1189
assert_eq ! (
1178
1190
error,
1179
- ValidationError ( vec! [ RuleError :: new(
1191
+ RuleError :: new(
1180
1192
"Variable \" $var\" got invalid value. \
1181
1193
Expected input scalar `Float`. Got: `\" 10\" `. \
1182
1194
Details: Expected `Float`, found: \" 10\" .",
1183
1195
& [ SourcePosition :: new( 8 , 0 , 8 ) ] ,
1184
- ) ] ) ,
1196
+ )
1197
+ . into( ) ,
1185
1198
) ;
1186
1199
}
1187
1200
}
0 commit comments