File tree Expand file tree Collapse file tree 3 files changed +18
-19
lines changed
src/FSharp.Data.GraphQL.Server
tests/FSharp.Data.GraphQL.Tests/Variables and Inputs Expand file tree Collapse file tree 3 files changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -171,21 +171,21 @@ module internal ReflectionHelper =
171171 else
172172 false
173173
174- let from =
174+ let actualFrom =
175175 if from.FullName.StartsWith OptionTypeName || from.FullName.StartsWith ValueOptionTypeName then
176176 from.GetGenericArguments()[ 0 ]
177177 else from
178- let ``to`` =
178+ let actualTo =
179179 if `` to `` .FullName.StartsWith OptionTypeName || `` to `` .FullName.StartsWith ValueOptionTypeName then
180180 `` to `` .GetGenericArguments()[ 0 ]
181181 else `` to ``
182182
183- let result = from .IsAssignableTo `` to `` || checkCollections from `` to ``
183+ let result = actualFrom .IsAssignableTo actualTo || checkCollections actualFrom actualTo
184184 if result then result
185185 else
186- if from .FullName.StartsWith OptionTypeName || from .FullName.StartsWith ValueOptionTypeName then
187- let from = from .GetGenericArguments()[ 0 ]
188- from .IsAssignableTo `` to `` || checkCollections from `` to ``
186+ if actualFrom .FullName.StartsWith OptionTypeName || actualFrom .FullName.StartsWith ValueOptionTypeName then
187+ let actualFrom = actualFrom .GetGenericArguments()[ 0 ]
188+ actualFrom .IsAssignableTo actualTo || checkCollections actualFrom actualTo
189189 else result
190190
191191 let matchConstructor ( t : Type ) ( fields : string []) =
Original file line number Diff line number Diff line change @@ -52,19 +52,19 @@ let private normalizeOptional (outputType : Type) value =
5252 valuesome value
5353 else
5454 // Use only when option or voption so must not be null
55- let realInputType = inputType.GenericTypeArguments.FirstOrDefault()
55+ let actualInputType = inputType.GenericTypeArguments.FirstOrDefault()
5656 if
5757 inputType.FullName.StartsWith ReflectionHelper.OptionTypeName
58- && outputType.IsAssignableFrom realInputType
58+ && outputType.IsAssignableFrom actualInputType
5959 then
60- let _ , _ , getValue = ReflectionHelper.optionOfType realInputType
60+ let _ , _ , getValue = ReflectionHelper.optionOfType actualInputType
6161 // none is null so it is already covered above
6262 getValue value
6363 elif
6464 inputType.FullName.StartsWith ReflectionHelper.ValueOptionTypeName
65- && outputType.IsAssignableFrom realInputType
65+ && outputType.IsAssignableFrom actualInputType
6666 then
67- let _ , valueNone , getValue = ReflectionHelper.vOptionOfType realInputType
67+ let _ , valueNone , getValue = ReflectionHelper.vOptionOfType actualInputType
6868 if value = valueNone then null else getValue value
6969 else
7070 value
Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ and WrongInput = {
239239let ``Schema cannot be created for unmatched input field types on record`` () =
240240
241241 let ``InputRecord without proper scalars Type`` =
242- Define.InputObject< InputRecord > (
242+ Define.InputObject< WrongInput > (
243243 " InputRecordWithoutProperScalars" ,
244244 [ Define.Input ( " id" , StringType)
245245 Define.Input ( " name" , StringType)
@@ -253,13 +253,12 @@ let ``Schema cannot be created for unmatched input field types on record`` () =
253253 query =
254254 Define.Object (
255255 " Query" ,
256- fun () ->
257- [ Define.Field (
258- " wrongRecord" ,
259- StringType,
260- [ Define.Input ( " record" , `` InputRecord without proper scalars Type `` ) ],
261- stringifyInput
262- ) ]
256+ [ Define.Field (
257+ " wrongRecord" ,
258+ StringType,
259+ [ Define.Input ( " record" , `` InputRecord without proper scalars Type `` ) ],
260+ stringifyInput
261+ ) ]
263262 )
264263 ) |> Executor :> obj
265264 )
You can’t perform that action at this time.
0 commit comments