You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -59,12 +57,12 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
59
57
60
58
init {
61
59
initialDictionary.forEach { (name, clazz) ->
62
-
if(!definitionsByName.containsKey(name)) {
60
+
if(!definitionsByName.containsKey(name)) {
63
61
throwSchemaClassScannerError("Class in supplied dictionary '${clazz.name}' specified type name '$name', but a type definition with that name was not found!")
64
62
}
65
63
}
66
64
67
-
if(options.allowUnimplementedResolvers) {
65
+
if(options.allowUnimplementedResolvers) {
68
66
log.warn("Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production.")
69
67
}
70
68
}
@@ -98,7 +96,7 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
98
96
}
99
97
100
98
privatefunscanQueue(): Boolean {
101
-
if(queue.isEmpty()) {
99
+
if(queue.isEmpty()) {
102
100
returnfalse
103
101
}
104
102
@@ -113,7 +111,7 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
113
111
* Adds all root resolvers for a type to the list of classes to scan
114
112
*/
115
113
privatefunhandleRootType(rootType:RootType?) {
116
-
if(rootType ==null) {
114
+
if(rootType ==null) {
117
115
return
118
116
}
119
117
@@ -135,7 +133,7 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
135
133
// Union types can also be excluded, as their possible types are resolved recursively later
val provided = scalars[definition.name] ?:throwSchemaClassScannerError("Expected a user-defined GraphQL scalar type with name '${definition.name}' but found none!")
log.warn("Root ${rootType.name} resolver was provided but no methods on it were used in data fetchers for GraphQL type '${rootType.type.name}'! Either remove the ${rootType.resolverInterface.name} interface from the resolver or remove the resolver entirely: $resolver")
182
182
}
183
183
}
@@ -186,20 +186,23 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
val unionTypeNames = dictionary.keys.filterIsInstance<UnionTypeDefinition>().map { union -> union.name }.toSet()
194
194
return dictionary.keys.filterIsInstance<UnionTypeDefinition>().map { union ->
195
-
union.memberTypes.filterIsInstance<TypeName>().filter { !unionTypeNames.contains(it.name) }.map { objectDefinitionsByName[it.name] ?:throwSchemaClassScannerError("No object type found with name '${it.name}' for union: $union") }
@@ -261,7 +264,7 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
261
264
262
265
if (realEntry.typeClass != clazz) {
263
266
if (options.preferGraphQLResolver && realEntry.hasResolverRef()) {
264
-
log.warn("The real entry ${realEntry.joinReferences()} is a GraphQLResolver so ignoring this one $clazz$reference")
267
+
log.warn("The real entry ${realEntry.joinReferences()} is a GraphQLResolver so ignoring this one $clazz$reference")
265
268
} else {
266
269
throwSchemaClassScannerError("Two different classes used for type ${type.name}:\n${realEntry.joinReferences()}\n\n- $clazz:\n| ${reference.getDescription()}")
267
270
}
@@ -280,7 +283,7 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
280
283
* Handle a newly found type, adding it to the list of actually used types and putting it in the scanning queue if it's an object type.
@@ -300,11 +303,11 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
300
303
false
301
304
)))
302
305
} else {
303
-
var mappingAdvice =""
306
+
var mappingAdvice ="Try adding it manually to the dictionary"
304
307
if (javaType.name.contains("Map")) {
305
-
mappingAdvice =". Try using a class to represent your input type instead of a Map."
308
+
mappingAdvice =" or add a class to represent your input type instead of a Map."
306
309
}
307
-
log.warn("Cannot find definition for field '${inputValueDefinition.name}: ${inputGraphQLType.name}' on input type '${graphQLType.name}' -> ${javaType.name}$mappingAdvice")
310
+
log.warn("Cannot find definition for field '${inputValueDefinition.name}: ${inputGraphQLType.name}' on input type '${graphQLType.name}' -> ${javaType.name}. $mappingAdvice")
308
311
}
309
312
}
310
313
}
@@ -314,8 +317,9 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
handleFoundType(interfaceDefinitionsByName[it.name] ?:throwSchemaClassScannerError("Object type ${graphQLType.name} declared interface ${it.name}, but no interface with that name was found in the schema!"), null, InterfaceReference(graphQLType))
?:throwSchemaClassScannerError("Object type ${graphQLType.name} declared interface ${it.name}, but no interface with that name was found in the schema!"), null, InterfaceReference(graphQLType))
319
323
}
320
324
}
321
325
}
@@ -324,7 +328,16 @@ internal class SchemaClassScanner(initialDictionary: BiMap<String, Class<*>>, al
throwSchemaClassScannerError("Type definition for root $name type '$typeName' not found!")
433
447
}
434
448
435
449
returnnull
436
450
}
437
451
438
-
if(type !isObjectTypeDefinition) {
452
+
if(type !isObjectTypeDefinition) {
439
453
throwSchemaClassScannerError("Expected root query type's type to be ${ObjectTypeDefinition::class.java.simpleName}, but it was ${type.javaClass.simpleName}")
440
454
}
441
455
442
456
// Find query resolver class
443
-
if(resolvers.isEmpty()) {
457
+
if(resolvers.isEmpty()) {
444
458
throwSchemaClassScannerError("No Root resolvers for $name type '$typeName' found! Provide one or more ${resolverInterface.name} to the builder.")
0 commit comments