What would be the best option to not use @id in interfaces?

Deprecated: “@id argument for get query on interface is being deprecated, it will be removed in v21.11.0, please update your query to not use that argument”

interface Person {
  id: ID!
  popcode: String! @id @search(by: [hash])
}

type Employee implements Person {
  taxcode: String! @id @search(by: [hash])
}

type Student implements Person {
  enrollment: String! @id @search(by: [hash])
}

query GetEmployee($popcode: String) {
  getEmployee(popcode: $popcode) {
    taxcode
  }
}

Hey @Beto,

Well the obvious “fix” would be to remove popcode from the Person interface and add it to the concrete types.

It’s also worth noting that the branch in which this deprecation warning was introduced is now abandoned. @Raphael, is the support for @id directives in interface types truly going away?

2 Likes