Is __resolveReference Optional? We can share data between subgraphs without it?

I have 2 subgraphs. Subgraph 2 wants to add new field to a type defined in subgraph1.

This new field defined in subgraph 2, requires data from subgraph 1. I was able to successfully achieve this with @requires directive. I was reading the documentation and it says that in order to share the data the subgraph also need to defined __resolveReference along with @requires. But I was able to achieve this with my normal resolver without __resolveReference.

Is __resolveReference Optional? Do we need only @requires to get the data from other subgraph?

There are 2 subgraph A and B.

Subgraph A has a type T1:

type T1 @key(fields: "id") {
  id: Int!
  name: String

Subgraph B:

extend type T1 @key(fields: "id") {
  id: Int! @external
  name: String  @external
  newField: String @requires(fields: "name")

Resolver for Subgraph B:

T1: {
    // obj contains data `id` and `name` from subgraph A
    return "newFieldData"

Here I was able to get name in subgraph B without definining __resolveReference in Subgraph A.

The default __resolveReference is simply:

const resolvers = {
  T1: {
    __resolveReference(reference) {
       return reference;

So yes, you can use @requires without defining a reference resolver yourself. The reference will be used as the first “source” argument for any field resolvers on the type.

What is the use of __resolveReference then?

The most common use case for logic in your reference resolver is to look up the entity by its id in a local data store to validate that it actually exists, and to fetch attributes that will be used by field resolvers on the type.