I am writing a custom resolver for interface field but it's never been called.
interface Entity {
resolverPoint(args: EntityType): String
}
This is Resolver
const resolvers = {
Entity: {
resolverPoint: (obj){
return ''
}
}
}
Interface fields cannot have implementations (pretty much like in many programming languages). Each of the types that implement the model must define their own resolver for this field.
interface Entity {
resolverPoint(args: EntityType): String
}
type ImplementingType implements Entity {
resolverPoint(args: EntityType): String
}
This will be called now:
const resolvers = {
ImplementingType: {
resolverPoint: (obj){
return ''
}
}
}
At least this is how the packages graphql-tools and graphql work. There are maybe other implementations that allow implementing types to inherit resolvers.