File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/FSharp.Data.GraphQL.Server Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -112,14 +112,19 @@ let rec internal compileByType
112112 { new Reflection.ParameterInfo() with
113113 member _.Name = f.Name
114114 member _.ParameterType = f.TypeDef.Type
115- member _.Attributes = Reflection.ParameterAttributes.Optional
115+ member _.Attributes =
116+ match f.TypeDef with
117+ | Nullable _ -> Reflection.ParameterAttributes.Optional
118+ | _ -> Reflection.ParameterAttributes.None
116119 }
117120 |]
118121 let constructor ( args : obj []) =
119122 let o = Activator.CreateInstance( objtype)
120123 let dict = o :?> IDictionary< string, obj>
121124 for fld, arg in Seq.zip objDef.Fields args do
122- dict.Add( fld.Name, arg)
125+ match arg, fld.TypeDef with
126+ | null , Nullable _ -> () // skip populating Nullable fields with nulls
127+ | _, _ -> dict.Add( fld.Name, arg)
123128 box o
124129 constructor, parameterInfos
125130 else
You can’t perform that action at this time.
0 commit comments