Skip to content

Apollo Federation, @extends directive and input types #678

@maurocolella

Description

@maurocolella

Describe the issue
We are using type-graphql with Apollo Federation. As per Apollo Federation guidelines, we try to keep code that relies on a service contained with that service.

So, say I have type A with a field that resolves to type B, I am going to use a @FieldResolver on type B, and return based on an entity stub with type A.

In order to do this, my stub uses @extends and @external directives. As in:

@Directive('@extends')
@Directive('@key(fields: "id")')
@ObjectType()
export class Member {
  @Directive('@external')
  @Field(type => ID)
  id: string;

This works great for object types.

The graphql spec, as far as I understand, allows basic type extensions for input types. But it's not clear to me whether Apollo Federation supports using @extends and @external to achieve this type of thing with input types.

Is it at all possible? If yes, is it possible using type-graphql? If not, does it make sense and is it on any roadmap?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Question ❔Not future request, proposal or bug issueSolved ✔️The issue has been solved

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions