Skip to content

Commit 2e6556a

Browse files
committed
Interpret lack of value for a field as .null within an InputType
1 parent 2fe3b0b commit 2e6556a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/GraphQL/Execution/Values.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func coerceValue(type: GraphQLInputType, value: Map) throws -> Map? {
147147
var objCopy = obj
148148
let field = fields[fieldName]
149149

150-
var fieldValue = try coerceValue(type: field!.type, value: value[fieldName]!)
150+
var fieldValue = try coerceValue(type: field!.type, value: value[fieldName] ?? .null)
151151

152152
if fieldValue == .null {
153153
fieldValue = field?.defaultValue

0 commit comments

Comments
 (0)