-
Notifications
You must be signed in to change notification settings - Fork 365
Open
Labels
type: bugSomething isn't workingSomething isn't working
Description
Library Version
8.8.1
Describe the bug
Also mentioned here (#2074). When running the example for interfaces https://opensource.expediagroup.com/graphql-kotlin/docs/schema-generator/writing-schemas/interfaces/, and querying the animal type, I receive an error because the subtypes of the interface don't get generated as GraphQL types.
To Reproduce
Steps to reproduce the behavior. Please provide:
- Schema Configuration
enum class AnimalTypes {
CAT,
DOG
}
interface Animal {
val type: AnimalTypes
fun sound(): String
}
class Cat : Animal {
override val type = AnimalTypes.CAT
override fun sound() = "meow"
fun ignoreEveryone(): String = "ignore everyone"
}
class Dog : Animal {
override val type = AnimalTypes.DOG
override fun sound() = "bark"
fun barkAtEveryone(): String = "bark at everyone"
}
- Query
query { animalType(type: CAT) { type }}
- Error Response
"errors": [
{
"message": "Can't resolve '/getAnimalByType'. Abstract type 'Animal' must resolve to an Object type at runtime for field 'Query.getAnimalByType'. Could not determine the exact type of 'Animal'",
"path": [
"getAnimalByType"
]
}
]
}
In graphiql, you can also see the subtypes don't exist

Expected behavior
Interfaces should generate the subtypes and the query should succeed
Metadata
Metadata
Assignees
Labels
type: bugSomething isn't workingSomething isn't working