Skip to content

GraphqlResolver defined out of GenericTypes not supported. #331

Closed
@abhi-rao

Description

@abhi-rao

The below use case is supported.

   abstract class FooResolver<T> implements GraphQLResolver<Bar> {
        String getValue(T foo) {
            return "value"
        }
    }

    class BarResolver extends FooResolver<Bar> {

   }

But the following way is not supported. Fails with
Caused by: com.coxautodev.graphql.tools.ResolverError: Unable to determine data class for resolver 'com.coxautodev.graphql.tools.SuperclassResolverSpec$BarResolver' from generic interface! This is most likely a bug with graphql-java-tools.

    abstract class FooResolver<T> implements GraphQLResolver<T> {
        String getValue(T foo) {
            return "value"
        }
    }

    class BarResolver extends FooResolver<Bar> {

   }

    class CarResolver extends FooResolver<Car> {

   }

Though the same approach can be supported currently, but it has duplicated code that can be made cleaner as proposed earlier.

    abstract class FooResolver<T> {
        String getValue(T foo) {
            return "value"
        }
    }

    class BarResolver extends FooResolver<Bar> implements GraphQLResolver<Bar>  {

    }

    class CarResolver extends FooResolver<Car> implements GraphQLResolver<Car> {

    }

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