Enigmatis / graphql-java-annotations

GraphQL Annotations for Java
Other
387 stars 97 forks source link

GraphQLAnnotations causes ClassCastException #235

Closed shevek closed 4 years ago

shevek commented 5 years ago

GraphQLAnnotations.java:

    public GraphQLObjectType object(Class<?> object) throws GraphQLAnnotationsException {

It's legitimate for this to be a GraphQLUnionType, which does not extend GraphQLObjectType. The sub-method being called has type <T [extends ...]> T

yarinvak commented 4 years ago

but the method object generates only GraphQLObjectTypes, so creating a GraphQLUnion using this method is incorrect

shevek commented 4 years ago

Yes, but an unadorned CCE isn't the most helpful way to tell the user that.