1

I am currently sucessfully being able to extend types across services.

Service A:

type User @key(fields: "id") {
  id: ID!
}

Service B:

extend type User @key(fields: "id") {
  id: ID! @external
  extendedList: [ExtendedType]
}

And then ofcource resolve this just fine. However I have one case where I want to do this within one subgraph, is this possible? I know the real solution would be to split those up into two subgraphs but this is not possible currently.

I have the following entities within one subgraph:

type Chat @key(fields: "id") {
  id: ID!
  listingId: String!
  createdAt: DateTime!
  updatedAt: DateTime!
  participants: [Participant!]!
  title: String!
}

type Message {
  id: ID!
  chatId: String!
  content: String!
  createdAt: DateTime!
  participant: Participant!
}

I dont always want to resolve messages when querying the Chat entity, and would like to do like I did in the example above and extend the type like such:

extend type Chat @key(fields: "id") {
  id: ID!
  messages: [Message!]!
}

Is this possible in any way when the entities are in the same subgraph?

Joelgullander
  • 1,624
  • 2
  • 20
  • 46

0 Answers0