@@ -24,15 +24,21 @@ type TestInput = {
2424 b: string option seq option
2525 c: string
2626 d: string option
27+ e: string option array option
2728}
29+
30+ let InputArrayOf ( innerDef : #TypeDef<'Val> ) : ListOfDef < 'Val , 'Val array > =
31+ ListOf innerDef
32+
2833let TestInputObject =
2934 Define.InputObject< TestInput>(
3035 name = " TestInputObject" ,
3136 fields = [
3237 Define.Input( " a" , Nullable String)
33- Define.Input( " b" , Nullable( ListOf ( Nullable String)))
38+ Define.Input( " b" , Nullable( ListOf ( Nullable String)) )
3439 Define.Input( " c" , String)
3540 Define.Input( " d" , Nullable TestComplexScalar)
41+ Define.Input( " e" , Nullable( InputArrayOf ( Nullable String)) )
3642 ])
3743
3844type TestNestedInput = {
@@ -85,9 +91,9 @@ let schema = Schema(TestType)
8591
8692[<Fact>]
8793let ``Execute handles objects and nullability using inline structs with complex input`` () =
88- let ast = parse """ { fieldWithObjectInput(input: {a: "foo", b: ["bar"], c: "baz"}) }"""
94+ let ast = parse """ { fieldWithObjectInput(input: {a: "foo", b: ["bar"], c: "baz", e: ["baf"] }) }"""
8995 let actual = sync <| Executor( schema) .AsyncExecute( ast)
90- let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":"foo","b":["bar"],"c":"baz","d":null}""" ]
96+ let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":"foo","b":["bar"],"c":"baz","d":null,"e":["baf"] }""" ]
9197 match actual with
9298 | Direct( data, errors) ->
9399 empty errors
@@ -98,7 +104,7 @@ let ``Execute handles objects and nullability using inline structs with complex
98104let ``Execute handles objects and nullability using inline structs and properly parses single value to list`` () =
99105 let ast = parse """ { fieldWithObjectInput(input: {a: "foo", b: "bar", c: "baz"}) }"""
100106 let actual = sync <| Executor( schema) .AsyncExecute( ast)
101- let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":"foo","b":["bar"],"c":"baz","d":null}""" ]
107+ let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":"foo","b":["bar"],"c":"baz","d":null,"e":null }""" ]
102108 match actual with
103109 | Direct( data, errors) ->
104110 empty errors
@@ -120,7 +126,7 @@ let ``Execute handles objects and nullability using inline structs and doesn't u
120126let ``Execute handles objects and nullability using inline structs and proprely coerces complex scalar types`` () =
121127 let ast = parse """ { fieldWithObjectInput(input: {c: "foo", d: "SerializedValue"}) }"""
122128 let actual = sync <| Executor( schema) .AsyncExecute( ast)
123- let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":null,"b":null,"c":"foo","d":"DeserializedValue"}""" ]
129+ let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":null,"b":null,"c":"foo","d":"DeserializedValue","e":null }""" ]
124130 match actual with
125131 | Direct( data, errors) ->
126132 empty errors
@@ -133,9 +139,9 @@ let ``Execute handles variables with complex inputs`` () =
133139 fieldWithObjectInput(input: $input)
134140 }"""
135141 let params ' : Map < string , obj > =
136- Map.ofList [ " input" , upcast { a = Some " foo" ; b = Some ( upcast [ Some " bar" ]) ; c = " baz" ; d = None }]
142+ Map.ofList [ " input" , upcast { a = Some " foo" ; b = Some ( upcast [| Some " bar" | ]) ; c = " baz" ; d = None ; e = None }]
137143 let actual = sync <| Executor( schema) .AsyncExecute( ast, variables = params')
138- let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":"foo","b":["bar"],"c":"baz","d":null}""" ]
144+ let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":"foo","b":["bar"],"c":"baz","d":null,"e":null }""" ]
139145 match actual with
140146 | Direct( data, errors) ->
141147 empty errors
@@ -148,7 +154,7 @@ let ``Execute handles variables with default value when no value was provided``
148154 fieldWithObjectInput(input: $input)
149155 }"""
150156 let actual = sync <| Executor( schema) .AsyncExecute( ast)
151- let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":"foo","b":["bar"],"c":"baz","d":null}""" ]
157+ let expected = NameValueLookup.ofList [ " fieldWithObjectInput" , upcast """ {"a":"foo","b":["bar"],"c":"baz","d":null,"e":null }""" ]
152158 match actual with
153159 | Direct( data, errors) ->
154160 empty errors
0 commit comments