我正在尝试在graphql-java中实现以下架构:
interface Character {
id: ID
name: String
actions: Actions
}
type Human implements Character {
id: ID
name: String
actions: HumanActions
}
type Droid implements Character {
id: ID
name: String
actions: DroidActions
}
interface Actions {
speak: String
}
type HumanActions implements Actions {
speak: String
sleep: Int
}
type DroidActions implements Actions {
speak: String
charge: Int
}
我相应地实现了我的java类。 我收到以下异常:
graphql.schema.validation.InvalidSchemaException: invalid schema:
object type 'Human' does not implement interface 'Character' because field 'actions' is defined as 'HumanActions' type and not as 'Actions' type
object type 'Droid' does not implement interface 'Character' because field 'actions' is defined as 'DroidActions' type and not as 'Actions' type
有没有办法实现我想要做的事情?