@@ -2,6 +2,7 @@ package graphql.kickstart.tools
22
33import graphql.kickstart.tools.resolver.FieldResolverError
44import graphql.language.SourceLocation
5+ import graphql.schema.GraphQLInterfaceType
56import graphql.schema.GraphQLSchema
67import org.springframework.aop.framework.ProxyFactory
78import spock.lang.Specification
@@ -418,6 +419,71 @@ class SchemaParserSpec extends Specification {
418419 noExceptionThrown()
419420 }
420421
422+ def " interface implementing an interface should have non-empty interface list" () {
423+ when :
424+ GraphQLSchema schema = SchemaParser . newParser(). schemaString(''' \
425+ interface Trait {
426+ id: ID!
427+ }
428+ interface MammalTrait implements Trait {
429+ id: ID!
430+ }
431+ type PoodleTrait implements Trait & MammalTrait {
432+ id: ID!
433+ }
434+
435+ interface Animal {
436+ id: ID!
437+ traits: [Trait]
438+ }
439+ interface Dog implements Animal {
440+ id: ID!
441+ traits: [MammalTrait]
442+ }
443+ type Poodle implements Animal & Dog {
444+ id: ID!
445+ traits: [PoodleTrait]
446+ }
447+
448+ type Query { test: [Poodle] }''' . stripIndent())
449+ .resolvers(new GraphQLQueryResolver () {
450+ static abstract class Trait {
451+ String id;
452+ }
453+
454+ static abstract class MammalTrait extends Trait {
455+ String id;
456+ }
457+
458+ static class PoodleTrait extends MammalTrait {
459+ String id;
460+ }
461+
462+ static abstract class Animal {
463+ String id;
464+ abstract List<Trait > traits;
465+ }
466+
467+ static abstract class Dog extends Animal {
468+ abstract List<MammalTrait > traits;
469+ }
470+
471+ static class Poodle extends Dog {
472+ List<PoodleTrait > traits;
473+ }
474+
475+ List<Poodle > test () { return new ArrayList<Poodle > (); }
476+ })
477+ .build()
478+ .makeExecutableSchema()
479+ GraphQLInterfaceType traitInterface = schema. getType(" MammalTrait" ) as GraphQLInterfaceType
480+ GraphQLInterfaceType dogInterface = schema. getType(" Dog" ) as GraphQLInterfaceType
481+
482+ then :
483+ ! traitInterface. interfaces. empty
484+ ! dogInterface. interfaces. empty
485+ }
486+
421487 enum EnumType {
422488 TEST
423489 }
0 commit comments