-
Couldn't load subscription status.
- Fork 174
Closed
Labels
Description
I'm using the library with Spring and CGLIB-based proxies.
I have a mutation class that looks like this:
@Component
public class Mutation {
public String changeIt(List<Foo> input) {
// ...
}
}
It works just fine, until I add something that wraps it in a CGLIB proxy (like @PreAuthorize on the mutation method). Then it blows up with:
Caused by: com.coxautodev.graphql.tools.SchemaClassScannerError: Unable to match type definition (NonNullType{type=ListType{type=TypeName{name='Foo'}}}) with java type (interface java.util.List): Java class is not a List: interface java.util.List
at com.coxautodev.graphql.tools.TypeClassMatcher.error(TypeClassMatcher.kt:23) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.TypeClassMatcher.match(TypeClassMatcher.kt:60) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.TypeClassMatcher.match$default(TypeClassMatcher.kt:27) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.TypeClassMatcher.match(TypeClassMatcher.kt:53) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.TypeClassMatcher.match(TypeClassMatcher.kt:25) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.matchTypeToClass(SchemaClassScanner.kt:222) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.matchTypeToClass$default(SchemaClassScanner.kt:222) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.handleFieldMethod(SchemaClassScanner.kt:186) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.scanObjectForDictionaryItems(SchemaClassScanner.kt:175) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.scanForClasses(SchemaClassScanner.kt:93) ~[graphql-java-tools-3.1.0.jar:na]
at com.coxautodev.graphql.tools.SchemaParserBuilder.build(SchemaParserBuilder.kt:107) ~[graphql-java-tools-3.1.0.jar:na]
The thing is, without the proxy the method argument obtained with reflection is parameterized List<Foo>. However, the proxy changes it to a plain List.
Does the schema actually need such strict verification?
One easy-ish way to solve it could be adding support for arrays. This should not lose type information:
public String changeIt(Foo[] input)