@@ -38,9 +38,9 @@ let TestComplexScalar =
38
38
)
39
39
40
40
type TestInput =
41
- { mand : string
42
- opt1 : string option
43
- opt2 : string option
41
+ { Mand : string
42
+ Opt : string option
43
+ GLCode : string option // for case-insensitive name match test
44
44
optSeq : string option seq option
45
45
voptSeq : string option seq voption // string voption seq voption is too hard to implement
46
46
optArr : string option array option
@@ -53,8 +53,8 @@ let TestInputObject =
53
53
name = " TestInputObject" ,
54
54
fields =
55
55
[ Define.Input ( " mand" , StringType)
56
- Define.Input ( " opt1 " , Nullable StringType)
57
- Define.Input ( " opt2 " , Nullable TestComplexScalar)
56
+ Define.Input ( " opt " , Nullable StringType)
57
+ Define.Input ( " glCode " , Nullable TestComplexScalar)
58
58
Define.Input ( " optSeq" , Nullable ( ListOf ( Nullable StringType)))
59
59
Define.Input ( " voptSeq" , Nullable ( ListOf ( Nullable StringType)))
60
60
Define.Input ( " optArr" , Nullable ( InputArrayOf ( Nullable StringType)))
@@ -72,13 +72,13 @@ let schema = Schema (TestType)
72
72
[<Fact>]
73
73
let ``Execute handles objects and nullability using inline structs with complex input`` () =
74
74
let ast =
75
- parse """ { fieldWithObjectInput(input: {mand: "baz", opt1 : "foo", optSeq: ["bar"], optArr: ["baf"]}) }"""
75
+ parse """ { fieldWithObjectInput(input: {mand: "baz", opt : "foo", optSeq: ["bar"], optArr: ["baf"]}) }"""
76
76
let result = sync <| Executor( schema) .AsyncExecute ( ast)
77
77
78
78
let expected =
79
79
NameValueLookup.ofList
80
80
[ " fieldWithObjectInput" ,
81
- upcast """ {"mand":"baz","opt1 ":"foo","opt2 ":null,"optSeq":["bar"],"voptSeq":null,"optArr":["baf"],"voptArr":null}""" ]
81
+ upcast """ {"mand":"baz","opt ":"foo","glCode ":null,"optSeq":["bar"],"voptSeq":null,"optArr":["baf"],"voptArr":null}""" ]
82
82
83
83
ensureDirect result <| fun data errors ->
84
84
empty errors
@@ -87,22 +87,22 @@ let ``Execute handles objects and nullability using inline structs with complex
87
87
// See https://spec.graphql.org/October2021/#sec-List
88
88
[<Fact( Skip = " Validation needs to be updated to allow" ) >]
89
89
let ``Execute handles objects and nullability using inline structs and properly parses single value to list`` () =
90
- let ast = parse """ { fieldWithObjectInput(input: {mand:"baz", opt1 : "foo", optSeq: "bar"}) }"""
90
+ let ast = parse """ { fieldWithObjectInput(input: {mand:"baz", opt : "foo", optSeq: "bar"}) }"""
91
91
let result = sync <| Executor( schema) .AsyncExecute ( ast)
92
92
let expected =
93
- NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"mand":"baz", "opt1 ":"foo", "optSeq":["bar"], "opt2 ":null, "optArr":null}""" ]
93
+ NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"mand":"baz", "opt ":"foo", "optSeq":["bar"], "glCode ":null, "optArr":null}""" ]
94
94
ensureDirect result <| fun data errors ->
95
95
empty errors
96
96
data |> equals ( upcast expected)
97
97
98
98
[<Fact>]
99
99
let ``Execute handles objects and nullability using inline structs and properly coerces complex scalar types`` () =
100
- let ast = parse """ { fieldWithObjectInput(input: {mand: "foo", opt2 : "SerializedValue"}) }"""
100
+ let ast = parse """ { fieldWithObjectInput(input: {mand: "foo", glCode : "SerializedValue"}) }"""
101
101
let result = sync <| Executor( schema) .AsyncExecute ( ast)
102
102
let expected =
103
103
NameValueLookup.ofList
104
104
[ " fieldWithObjectInput" ,
105
- upcast """ {"mand":"foo","opt1 ":null,"opt2 ":"DeserializedValue","optSeq":null,"voptSeq":null,"optArr":null,"voptArr":null}""" ]
105
+ upcast """ {"mand":"foo","opt ":null,"glCode ":"DeserializedValue","optSeq":null,"voptSeq":null,"optArr":null,"voptArr":null}""" ]
106
106
107
107
ensureDirect result <| fun data errors ->
108
108
empty errors
@@ -116,7 +116,7 @@ let paramsWithValueInput input =
116
116
.RootElement.Deserialize< ImmutableDictionary< string, JsonElement>> ( serializerOptions)
117
117
118
118
let testInputObject =
119
- """ {"mand":"baz","opt1 ":"foo","opt2 ":null,"optSeq":["bar"],"voptSeq":["bar"],"optArr":null,"voptArr":null}"""
119
+ """ {"mand":"baz","opt ":"foo","glCode ":null,"optSeq":["bar"],"voptSeq":["bar"],"optArr":null,"voptArr":null}"""
120
120
121
121
[<Fact>]
122
122
let ``Execute handles variables with complex inputs`` () =
@@ -137,7 +137,7 @@ let ``Execute handles variables with complex inputs`` () =
137
137
let ``Execute handles variables with default value when no value was provided`` () =
138
138
let ast =
139
139
parse
140
- """ query q($input: TestInputObject = {mand:"baz", opt1 : "foo", optSeq: ["bar"], voptSeq:["bar"]}) {
140
+ """ query q($input: TestInputObject = {mand:"baz", opt : "foo", optSeq: ["bar"], voptSeq:["bar"]}) {
141
141
fieldWithObjectInput(input: $input)
142
142
}"""
143
143
@@ -155,7 +155,7 @@ let ``Execute handles variables and errors on null for nested non-nulls`` () =
155
155
fieldWithObjectInput(input: $input)
156
156
}"""
157
157
158
- let testInputObject = """ {"mand":null, "opt1 ":"foo", "optSeq":["bar"], "voptSeq":["bar"]}"""
158
+ let testInputObject = """ {"mand":null, "opt ":"foo", "optSeq":["bar"], "voptSeq":["bar"]}"""
159
159
let params ' = paramsWithValueInput testInputObject
160
160
let result = sync <| Executor( schema) .AsyncExecute ( ast, variables = params')
161
161
ensureRequestError result <| fun [ error ] ->
@@ -185,7 +185,7 @@ let ``Execute handles variables and errors on omission of nested non-nulls`` ()
185
185
fieldWithObjectInput(input: $input)
186
186
}"""
187
187
188
- let testInputObject = """ {"opt1 ":"foo","optSeq":["bar"]}"""
188
+ let testInputObject = """ {"opt ":"foo","optSeq":["bar"]}"""
189
189
let params ' = paramsWithValueInput testInputObject
190
190
let result = sync <| Executor( schema) .AsyncExecute ( ast, variables = params')
191
191
ensureRequestError result <| fun [ error ] ->
@@ -199,7 +199,7 @@ let ``Execute handles list inputs and nullability and does not allow invalid typ
199
199
""" query q($input: TestInputObject!) {
200
200
fieldWithObjectInput(input: $input)
201
201
}"""
202
- // as that kind of an error inside of opt1 query is guaranteed to fail in every call, we're gonna to fail noisy here
202
+ // as that kind of an error inside of opt query is guaranteed to fail in every call, we're gonna to fail noisy here
203
203
let testInputList = " [\" A\" ,\" B\" ]"
204
204
let params ' = paramsWithValueInput testInputList
205
205
let result = sync <| Executor( schema) .AsyncExecute ( ast, variables = params')
@@ -217,7 +217,7 @@ let ``Execute handles list inputs and nullability and does not allow unknown typ
217
217
""" query q($input: UnknownType!) {
218
218
fieldWithObjectInput(input: $input)
219
219
}"""
220
- // as that kind of an error inside of opt1 query is guaranteed to fail in every call, we're gonna to fail noisy here
220
+ // as that kind of an error inside of opt query is guaranteed to fail in every call, we're gonna to fail noisy here
221
221
let testInputValue = " \" whoknows\" "
222
222
let params ' = paramsWithValueInput testInputValue
223
223
let result = sync <| Executor( schema) .AsyncExecute ( ast, variables = params')
0 commit comments