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 @@ -96,14 +96,19 @@ let rec internal compileByType (inputObjectPath: FieldPath) (inputSource : Input
9696 { new Reflection.ParameterInfo() with
9797 member _.Name = f.Name
9898 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
100103 }
101104 |]
102105 let constructor ( args : obj []) =
103106 let o = Activator.CreateInstance( objtype)
104107 let dict = o :?> IDictionary< string, obj>
105108 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)
107112 box o
108113 constructor, parameterInfos
109114 else
You can’t perform that action at this time.
0 commit comments