Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypesImplementInterfaces check fails for interfaces implementing interfaces #2072

Closed
KammererTob opened this issue Oct 14, 2020 · 0 comments
Closed

Comments

@KammererTob
Copy link
Contributor

KammererTob commented Oct 14, 2020

With v15.0 and the support for interfaces implementing interfaces it seems like the TypesImplementInterfaces fails in some scenarios. This line:

https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/validation/TypesImplementInterfaces.java#L175

only works when one is of type GraphQLObjectType and the other of GraphQLInterfaceType. There can be cases where both are interfaces now.

interface Trait {
    name: String
}

interface MammalTrait implements Trait {
    name: String
}

interface Animal {
    traits: [Trait]
}

type Dog implements Animal {
    traits: [MammalTrait]
}

This leads to:
Caused by: graphql.schema.validation.InvalidSchemaException: invalid schema:
object type 'Dog' does not implement interface 'Animal' because field 'traits' is defined as '[MammalTrait]' type and not as '[Trait]' type

KammererTob added a commit to KammererTob/graphql-java that referenced this issue Oct 14, 2020
andimarek added a commit that referenced this issue Oct 15, 2020
Fix TypesImplementInterfaces.check() for interfaces implementing interface #2072
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant