Skip to content

Commit 79e823c

Browse files
committed
make test pass
1 parent 12971e2 commit 79e823c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/utils/should-consolidate-types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ function typesAreEquivalent(
7171
const matchingInputField = inputNode.astNode?.fields?.find(
7272
(inputField) => inputField.name.value === typeField.name.value,
7373
);
74-
if (!matchingInputField?.type) return false;
74+
if (
75+
!matchingInputField?.type ||
76+
typeField.type.kind !== matchingInputField.type.kind
77+
) {
78+
return false;
79+
}
80+
7581
const baseTypeName = getBaseTypeNode(typeField.type).name.value;
7682
const baseInputTypeName = getBaseTypeNode(matchingInputField.type).name
7783
.value;

test/unit/should_consolidate_input_and_output_types/expected.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,9 @@ data class MyNullabilityType(
136136

137137
@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.INPUT_OBJECT])
138138
data class MyNullabilityTypeInput(
139-
val field1: MyNestedNullabilityTypeInput
139+
val field1: MyNestedNullabilityType? = null
140140
)
141141

142-
@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT])
143142
data class MyNestedNullabilityType(
144143
val field2: String
145144
)
146-
147-
@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.INPUT_OBJECT])
148-
data class MyNestedNullabilityTypeInput(
149-
val field2: String
150-
)

0 commit comments

Comments
 (0)