Kickstart GraphQL Spring Boot Resolution Error Misdirection

Posted on September 18, 2023
Tags: java, spring

Using com.graphql-java-kickstart:graphql-spring-boot-starter:14.1.0 I was refactoring some code to switch Strings for enums and I got the following error.

Caused by: Type 'Integration' is declared as an enum in the GraphQL schema but is not a Java enum!

I double checked, and Integration was in the GraphQL correctly, and was also a proper Java enum.


enum Integration {

input IntegrationCriteria {
    integration: Integration
    identifier: String

Java enum:

public enum Integration {

Putting a breakpoint in the GraphQL code, the enum code resolves the type via dictionary.

    private fun createEnumObject(definition: EnumTypeDefinition): GraphQLEnumType {
        val name =
        val type = dictionary[definition]
            ?: throw SchemaError("Expected enum with name '$name' but found none!")
        if (!type.unwrap().isEnum) throw SchemaError("Type '$name' is declared as an enum in the GraphQL schema but is not a Java enum!")

It turns out dictionary is derived from the types used in the referenced classes.

It turns out that in my refactoring I’d changed the wrong String. The error didn’t actually point to this as the error though, it said

public class IntegrationCriteria {
    // WRONG
    private Integration identifier;

    private String integration;