We have a situation where we have set up managed gql federation. We want to move definitions and resolvers of some entities from one service to other.
It can be illustrated on the example of Entities in Apollo Federation - Apollo GraphQL Docs
Our service “gateway-service” defines entity “ExternalDraftDeal” with some extensions
type ExternalDraftDeal @key(fields: "id") {
id: ID!
acquisitionId: String
createdAt: String!
createdBy: Author!
}
extend type ExternalDraftDeal {
author: AuthorDetails!
}
... #some other entities and types
# Not sure if this union is also important or not
union ExternalDealsUnion = ExternalDraftDeal | ExternalLockedDeal | ExternalPublishedDeal | ExternalUnlockedDeal | ExternalArchivedDeal
We want to move this entity to deals-service (only the base entity). This entity is defined there as
type ExternalDraftDeal @key(fields: "id") {
id: ID!
acquisitionId: String
createdAt: String!
createdBy: Author!
}
... #some other entities and types
# Not sure if this union is also important or not
union ExternalDealsUnion = ExternalDraftDeal | ExternalLockedDeal | ExternalPublishedDeal | ExternalUnlockedDeal | ExternalArchivedDeal
However when checking the types from the deals-service by executing
npx -p @apollo/rover rover subgraph check
We get the following error
VALUE_TYPE_NO_ENTITY: [gateway-service] ExternalDraftDeal -> Value types cannot be entities (using the `@key` directive). Please ensure that the `ExternalDraftDeal` type is extended properly or remove the `@key` directive if this is not an entity.
According to the docs at Understanding errors - Apollo Server - Apollo GraphQL Docs this error indicates that we can’t have tow identical entities. However the migration tutorial explicitly states that for migration we should have identical entities.