Skip to content

Commit bc1a536

Browse files
committed
Remove unused types property in DictionaryTypeResolver.
1 parent 181a937 commit bc1a536

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import graphql.schema.TypeResolver
1313
* @author Andrew Potter
1414
*/
1515
internal abstract class DictionaryTypeResolver(
16-
private val dictionary: BiMap<JavaType, TypeDefinition<*>>,
17-
private val types: Map<String, GraphQLObjectType>
16+
private val dictionary: BiMap<JavaType, TypeDefinition<*>>
1817
) : TypeResolver {
1918
private fun <T> getTypeDefinition(clazz: Class<T>): TypeDefinition<*>? {
2019
return dictionary[clazz]
@@ -33,22 +32,18 @@ internal abstract class DictionaryTypeResolver(
3332

3433
internal class InterfaceTypeResolver(
3534
dictionary: BiMap<JavaType, TypeDefinition<*>>,
36-
private val thisInterface: GraphQLInterfaceType,
37-
types: List<GraphQLObjectType>
35+
private val thisInterface: GraphQLInterfaceType
3836
) : DictionaryTypeResolver(
39-
dictionary,
40-
types.filter { type -> type.interfaces.any { it.name == thisInterface.name } }.associateBy { it.name }
37+
dictionary
4138
) {
4239
override fun getError(name: String) = "Expected object type with name '$name' to implement interface '${thisInterface.name}', but it doesn't!"
4340
}
4441

4542
internal class UnionTypeResolver(
4643
dictionary: BiMap<JavaType, TypeDefinition<*>>,
47-
private val thisUnion: GraphQLUnionType,
48-
types: List<GraphQLObjectType>
44+
private val thisUnion: GraphQLUnionType
4945
) : DictionaryTypeResolver(
50-
dictionary,
51-
types.filter { type -> thisUnion.types.any { it.name == type.name } }.associateBy { it.name }
46+
dictionary
5247
) {
5348
override fun getError(name: String) = "Expected object type with name '$name' to exist for union '${thisUnion.name}', but it doesn't!"
5449
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class SchemaParser internal constructor(
8585
val enums = enumDefinitions.map { createEnumObject(it) }
8686

8787
// Assign type resolver to interfaces now that we know all of the object types
88-
interfaces.forEach { codeRegistryBuilder.typeResolver(it, InterfaceTypeResolver(dictionary.inverse(), it, objects)) }
89-
unions.forEach { codeRegistryBuilder.typeResolver(it, UnionTypeResolver(dictionary.inverse(), it, objects)) }
88+
interfaces.forEach { codeRegistryBuilder.typeResolver(it, InterfaceTypeResolver(dictionary.inverse(), it)) }
89+
unions.forEach { codeRegistryBuilder.typeResolver(it, UnionTypeResolver(dictionary.inverse(), it)) }
9090

9191
// Find query type and mutation/subscription type (if mutation/subscription type exists)
9292
val queryName = rootInfo.getQueryName()

0 commit comments

Comments
 (0)