Skip to content

Commit b4cd4f0

Browse files
oryan-blockclaude
andcommitted
Expect the scanner's enum error for a directive enum in a Map input
The directive enum test from #852 expected the parser's "Expected enum with name 'Purpose' but found none!" for an enum that's also used by an input field bound to a Map. With this branch the scanner already fails for that enum, since no class can be found for it, and names the input type, the field and how to fix it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0ae99e1 commit b4cd4f0

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerDirectiveTest.kt‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class SchemaClassScannerDirectiveTest {
249249
missingEnum)
250250

251251
// an input field bound to a Map, which would get the enum's values
252-
assertSchemaError(
252+
val mapError = assertThrows(SchemaClassScannerError::class.java) {
253253
SchemaParser.newParser()
254254
.schemaString(linkDirective)
255255
.schemaString(
@@ -258,8 +258,12 @@ class SchemaClassScannerDirectiveTest {
258258
259259
type Query { hello(filter: Filter!): String }
260260
""")
261-
.resolvers(object : GraphQLQueryResolver { fun hello(filter: Map<String, Any>): String = filter.toString() }),
262-
missingEnum)
261+
.resolvers(object : GraphQLQueryResolver { fun hello(filter: Map<String, Any>): String = filter.toString() })
262+
.build()
263+
}
264+
assertEquals(mapError.message, "Enum type 'Purpose' is used by field 'purpose' of input type 'Filter', but its Java enum can't be determined " +
265+
"because 'Filter' is bound to java.util.Map, which has no type information for its fields. Pass the enum class for type " +
266+
"'Purpose' in the parser's dictionary, or use a class for 'Filter' with a public getter or field 'purpose'.")
263267

264268
// an argument of an unimplemented field added by an extension
265269
assertSchemaError(

0 commit comments

Comments
 (0)