Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Webflux ClassCastException for Flux response type #325

Open
@Sam-Kruglov

Description

@Sam-Kruglov

If a resolver has Flux<...> return type and schema has [...] return type then it will crash on this line:

com/graphql-java-kickstart/graphql-java-tools/5.7.1/graphql-java-tools-5.7.1-sources.jar!/com/coxautodev/graphql/tools/TypeClassMatcher.kt:78

is ListType -> {
   // realType is ParameterizedTypeImpl but isListType is false
    if (realType is ParameterizedType && isListType(realType, potentialMatch)) {
        match(potentialMatch, graphQLType.type, realType.actualTypeArguments.first())
   // cast exception
    } else if ((realType as Class<*>).isArray) {
        match(potentialMatch, graphQLType.type, realType.componentType)
    } else {
        throw error(potentialMatch, "Java class is not a List or generic type information was lost: $realType")
    }
}

It works if such query is actually a subscription of return type ... and the resolver of Publisher<...>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions