In the dgraph schema, if there is an interface that two types implement but both the types have the exact same fields then how to write it?

I know something like this won’t work…where both cat and cow have id, fur, and height with same type

interface mammal {
  id: ID
  fur: Boolean
  height: Int
}

type cat implements mammal {
}

type cow implements mammal {
}

You may write the same fields in the implementing types.

You can use this schema in this case:

interface mammal {
  id: ID
  fur: Boolean
  height: Int
}

type cat implements mammal {
  id: ID
  fur: Boolean
  height: Int
}

type cow implements mammal {
  id: ID
  fur: Boolean
  height: Int
}

Linking related discuss post: Interfaces are not GraphQL compliant

1 Like

ok Thanks!