How is a Java enum correctly registered with GraphQL when using the kickstart framework with spring?
In attempting to use a GraphQL schema enum with an equivalent Java enum in a simple Java Spring application, the following exception is thrown:
Caused by: graphql.kickstart.tools.SchemaError: Expected enum with name 'CarType' but found none!
at graphql.kickstart.tools.SchemaParser.createEnumObject(SchemaParser.kt:191)
at graphql.kickstart.tools.SchemaParser.parseSchemaObjects(SchemaParser.kt:85)
at graphql.kickstart.tools.SchemaParser.makeExecutableSchema(SchemaParser.kt:112)
at graphql.kickstart.tools.boot.GraphQLJavaToolsAutoConfiguration.graphQLSchema(GraphQLJavaToolsAutoConfiguration.java:147)
at graphql.kickstart.tools.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$1b4eddf2.CGLIB$graphQLSchema$1(<generated>)
How is the Java side enum class registered? I've seen examples with RuntimeWiring and registering them via this but the schema creation is done automatically for my usage so I cannot find a way (or the correct hook) to achieve this.
The GraphQL schema is:
extend type Query {
cars : [Car]
}
type Car {
type : CarType
}
enum CarType {
AUDI,
BMW,
VOLKSWAGEN
}
And the Java enum:
public enum CarType {
AUDI, BMW, VOLKSWAGEN
}