Skip to content

graphql interfaces can extend other interfaces #2772

@hamnis

Description

@hamnis

This seems like a missing feature in caliban.

def makeInterface(
name: Option[String],
description: Option[String],
fields: () => List[__Field],
subTypes: List[__Type],
origin: Option[String] = None,
directives: Option[List[Directive]] = None
): __Type =
__Type(
__TypeKind.INTERFACE,
name,
description,
fields =
args => if (args.includeDeprecated.getOrElse(false)) Some(fields()) else Some(fields().filter(!_.isDeprecated)),
possibleTypes = Some(subTypes),
origin = origin,
directives = directives
)

This is supported for types and objects but not interfaces

def makeObject(
name: Option[String],
description: Option[String],
fields: List[__Field],
directives: List[Directive],
origin: Option[String] = None,
interfaces: () => Option[List[__Type]] = () => Some(Nil)
): __Type =
__Type(
__TypeKind.OBJECT,
name,
description,
fields =
args => if (args.includeDeprecated.getOrElse(false)) Some(fields) else Some(fields.filter(!_.isDeprecated)),
interfaces = interfaces,
directives = Some(directives),
origin = origin
)

The specification allows this: https://spec.graphql.org/draft/#sec-Interfaces

Metadata

Metadata

Assignees

No one assigned

    Labels

    serverIssue related to caliban serverspecIssue related to the graphql spec

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions