File tree 1 file changed +7
-2
lines changed
src/FSharp.Data.GraphQL.Server
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,19 @@ let rec internal compileByType (inputObjectPath: FieldPath) (inputSource : Input
96
96
{ new Reflection.ParameterInfo() with
97
97
member _.Name = f.Name
98
98
member _.ParameterType = f.TypeDef.Type
99
- member _.Attributes = Reflection.ParameterAttributes.Optional
99
+ member _.Attributes =
100
+ match f.TypeDef with
101
+ | Nullable _ -> Reflection.ParameterAttributes.Optional
102
+ | _ -> Reflection.ParameterAttributes.None
100
103
}
101
104
|]
102
105
let constructor ( args : obj []) =
103
106
let o = Activator.CreateInstance( objtype)
104
107
let dict = o :?> IDictionary< string, obj>
105
108
for fld, arg in Seq.zip objDef.Fields args do
106
- dict.Add( fld.Name, arg)
109
+ match arg, fld.TypeDef with
110
+ | null , Nullable _ -> () // skip populating Nullable fields with nulls
111
+ | _, _ -> dict.Add( fld.Name, arg)
107
112
box o
108
113
constructor, parameterInfos
109
114
else
You can’t perform that action at this time.
0 commit comments