Skip to content

Interface objects are not put into the scan queue #105

@KammererTob

Description

@KammererTob

I noticed a possible bug in the implementation of the scanner. If you add a complex property (object/enum) to an interface only it does not get detected, because interfaces are not added to the scanning queue.
Here is an example:

interface Competition {
    discipline: Discipline
}

type TestCompetition implements Competition {
    test: String
}

enum Discipline {
    TEST
}

extend type Query {
    competitions() : [Competition]
}

Discipline is not used anywhere else. On startup i get this warning:

c.c.graphql.tools.SchemaClassScanner : Schema type was defined but can never be accessed, and can be safely deleted: Discipline

And later this error:

Caused by: com.coxautodev.graphql.tools.SchemaError: Expected type 'Discipline' to be a GraphQLOutputType, but it wasn't! Was a type only permitted for object types incorrectly used as an input type, or vice-versa?

I tracked this bug(?) down to this method: https://github.com/graphql-java/graphql-java-tools/blob/master/src/main/kotlin/com/coxautodev/graphql/tools/SchemaClassScanner.kt#L263

It is neither an ObjectType nor an InputType and thus nothing happens with the interface. Am i doing something wrong or is this indeed a bug?

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