-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathlist_inputs.ml
43 lines (37 loc) · 1.06 KB
/
list_inputs.ml
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
open Test_shared
module MyQuery =
[%graphql
{|
query ($arg: ListsInput!) {
listsInput(arg: $arg)
}
|}]
type qt = MyQuery.t
let pp formatter (obj : qt) =
Format.fprintf formatter "< listsInput = @[%s@] >" obj.listsInput
let equal (a : qt) (b : qt) = a.listsInput = b.listsInput
let allows_none_in_lists_of_nullable () =
test_json_
(MyQuery.makeVariables
~arg:
{
nullableOfNullable = Some [| Some "x"; None; Some "y" |];
nullableOfNonNullable = None;
nonNullableOfNullable = [| Some "a"; None; Some "b" |];
nonNullableOfNonNullable = [| "1"; "2"; "3" |];
}
()
|> MyQuery.serializeVariables |> MyQuery.variablesToJson)
(Json.Read.from_string
{| {
"arg": {
"nullableOfNullable": ["x", null, "y"],
"nullableOfNonNullable": null,
"nonNullableOfNullable": ["a", null, "b"],
"nonNullableOfNonNullable": ["1", "2", "3"]
}
} |})
let tests =
[
("Allows None in lists of nullable types", allows_none_in_lists_of_nullable);
]