Skip to content

Commit 4b83c0b

Browse files
committed
Restrict to composite and enum types.
1 parent 7e2b4fb commit 4b83c0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ internal class SchemaClassScanner(
9191
do {
9292
val unusedDefinitions = (definitionsByName.values - (dictionary.keys.toSet() + unvalidatedTypes))
9393
.filter { definition -> definition.name != "PageInfo" }
94+
.filter { isCompositeOrEnumType(it) }
9495
.distinct()
9596

9697
if (unusedDefinitions.isEmpty()) {
@@ -104,6 +105,10 @@ internal class SchemaClassScanner(
104105
return validateAndCreateResult(rootTypeHolder)
105106
}
106107

108+
private fun isCompositeOrEnumType(definition: TypeDefinition<*>): Boolean {
109+
return definition is ObjectTypeDefinition || definition is InterfaceTypeDefinition || definition is UnionTypeDefinition || definition is EnumTypeDefinition
110+
}
111+
107112
private fun scanQueue(): Boolean {
108113
if (queue.isEmpty()) {
109114
return false

0 commit comments

Comments
 (0)