Extend shareable object in Apollo GraphQL Federation v2

58 views Asked by At

Hi guys I have a question, I can't solve this: I have a shared object between multiple subgraphs. In one subgraph I need to add 2 more fields to this shared object. I tried using "extend" but it's not working, rover is giving me error when composing.

I tried this

schema1.graphql

type GenericResponse @shareable {
  "Set true false for the response of the API"
  success: Boolean!

  "Error Code of the message"
  errorCode: String

  "Human Readable Error Message"
  errorMessage: String
}

schema2.graphql

type GenericResponse @shareable {
  "Set true false for the response of the API"
  success: Boolean!

  "Error Code of the message"
  errorCode: String

  "Human Readable Error Message"
  errorMessage: String
}

extend type GenericResponse {
  "Remaining login attempts"
  remainingLoginAttempts: Int

  "Default lock out time"
  defaultLockOutTime: String
}

Is it possible to reuse the shared object? or should I create a new object with a different name? thanks for your help

0

There are 0 answers