Skip to content

Commit 093678b

Browse files
committed
Fix value coercion check for OneOf type
1 parent 1dbdadc commit 093678b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/utilities/coerceInputValue.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,16 @@ function coerceInputValueImpl(
153153
`Exactly one key must be specified for OneOf type "${type}".`,
154154
),
155155
);
156-
}
157-
158-
const key = keys[0];
159-
const value = coercedValue[key];
160-
if (value === null) {
161-
onError(
162-
pathToArray(path).concat(key),
163-
value,
164-
new GraphQLError(`Field "${key}" must be non-null.`),
165-
);
156+
} else {
157+
const key = keys[0];
158+
const value = coercedValue[key];
159+
if (value === null) {
160+
onError(
161+
pathToArray(path).concat(key),
162+
value,
163+
new GraphQLError(`Field "${key}" must be non-null.`),
164+
);
165+
}
166166
}
167167
}
168168

0 commit comments

Comments
 (0)