Skip to content

Commit 84a87ee

Browse files
committed
Fix lint violations
1 parent 903555d commit 84a87ee

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/type/validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ function validateOneOfInputObjectField(
561561
);
562562
}
563563

564-
if (field.defaultValue) {
564+
if (field.defaultValue !== undefined) {
565565
context.reportError(
566566
`OneOf input field ${type.name}.${field.name} cannot have a default value.`,
567567
field.astNode,

src/validation/rules/ValuesOfCorrectTypeRule.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { didYouMean } from '../../jsutils/didYouMean.js';
22
import { inspect } from '../../jsutils/inspect.js';
3-
import { keyMap } from '../../jsutils/keyMap.js';
4-
import type { ObjMap } from '../../jsutils/ObjMap.js';
53
import { suggestionList } from '../../jsutils/suggestionList.js';
64

75
import { GraphQLError } from '../../error/GraphQLError.js';
@@ -186,10 +184,10 @@ function validateOneOfInputObject(
186184
context: ValidationContext,
187185
node: ObjectValueNode,
188186
type: GraphQLInputObjectType,
189-
fieldNodeMap: ObjMap<ObjectFieldNode>,
187+
fieldNodeMap: Map<string, ObjectFieldNode>,
190188
variableDefinitions: { [key: string]: VariableDefinitionNode },
191189
): void {
192-
const keys = Object.keys(fieldNodeMap);
190+
const keys = Array.from(fieldNodeMap.keys());
193191
const isNotExactlyOneField = keys.length !== 1;
194192

195193
if (isNotExactlyOneField) {
@@ -202,9 +200,9 @@ function validateOneOfInputObject(
202200
return;
203201
}
204202

205-
const value = fieldNodeMap[keys[0]].value;
206-
const isNullLiteral = value.kind === Kind.NULL;
207-
const isVariable = value.kind === Kind.VARIABLE;
203+
const value = fieldNodeMap.get(keys[0])?.value;
204+
const isNullLiteral = !value || value.kind === Kind.NULL;
205+
const isVariable = value?.kind === Kind.VARIABLE;
208206

209207
if (isNullLiteral) {
210208
context.reportError(

0 commit comments

Comments
 (0)