Hey guys, I have federated services and I just bumped into a problem. In my authentication service I take user from database by his phone, and I try to return it, however, it extends user entity that stands in another service, so even if I have all the data for user, it still goes with {__typename: 'User', id: string}
to my subgraph and looks for resolveReference, this way I retrieve data from database twice… Is there are a way how to solve this? How could I return data if I have it? Would appreciate any help tho!
Please post a sample schema doc for both federated services.
Hello! If your authentication service can resolve fields of the User
type that don’t originate in the authentication service, you can use the @provides
directive to indicate this capability (see the documentation).
The gateway can use this information in its query plan to avoid making a follow-up request to the originating service that results in an additional database fetch.