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
112
112
{ new Reflection.ParameterInfo() with
113
113
member _.Name = f.Name
114
114
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
116
119
}
117
120
|]
118
121
let constructor ( args : obj []) =
119
122
let o = Activator.CreateInstance( objtype)
120
123
let dict = o :?> IDictionary< string, obj>
121
124
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)
123
128
box o
124
129
constructor, parameterInfos
125
130
else
You can’t perform that action at this time.
0 commit comments