Skip to content

Commit

Permalink
Fix value coercion check for OneOf type
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Sep 7, 2024
1 parent 1dbdadc commit 093678b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/utilities/coerceInputValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,16 @@ function coerceInputValueImpl(
`Exactly one key must be specified for OneOf type "${type}".`,
),
);
}

const key = keys[0];
const value = coercedValue[key];
if (value === null) {
onError(
pathToArray(path).concat(key),
value,
new GraphQLError(`Field "${key}" must be non-null.`),
);
} else {
const key = keys[0];
const value = coercedValue[key];
if (value === null) {
onError(
pathToArray(path).concat(key),
value,
new GraphQLError(`Field "${key}" must be non-null.`),
);
}
}
}

Expand Down

0 comments on commit 093678b

Please sign in to comment.