Adding a reference resolver to the federated schema generated by the graphql library

Hey Community folks,

I needed some help for defining a reference resolver in a schema that is generated by the graphql library.

I have two neo4j services both of them are being served through grapqql apis, one of them is generated by the library and for one I am writing my own resolvers and typedefs.

This is schema file for the service that is generated by the library (PATENT service) :

type PATENT  @key(fields : "app_num")  @shareable {
	actual_disposal_type: String
	aia: String
	app_num: String!
	has_applicants: [APPLICANT!]! @relationship(type: "IS_APPLICANT_OF", direction: IN)
}

These are the typedefs and resolvers for the second service (ASSIGNMENT service):

type ASSIGNMENT {
        conveyance_text: String
        correspondent: String
        correspondent_address: String
        country: String
        frame_no: String
        id: String!
        has_patents: [PATENT!]!
        recorded_date: String
        reel_no: String
    }
    extend type PATENT  @key(fields: "app_num") {
        app_num: String @external
        has_assignments : [ASSIGNMENT!]!
    }

    extend type Query {
        assignments (app_num : String): [ASSIGNMENT!]!
    }
const {get_assignments, get_related_assignments, get_related_patents} = require('../db_methods/methods.js')

const resolvers = {
    PATENT: {
        has_assignments: async (parent, args) => {
            try {
                console.log("parent.app_num: " + parent.app_num);
                const result = await get_related_assignments(parent.app_num)
                console.log(result);
                return result
            }
            catch (err) {
                console.log(err)
            }
        }
    },
    ASSIGNMENT: {
        has_patents: async (parent, args) => {
            try {
                const result = await get_related_patents(parent.id)
                return result.map((app_num) => ({__typename: "PATENT", app_num}))
            }
            catch (err) {
                console.log(err)
            }
        }
    }
    ,
    Query: {
        assignments: async (obj, {app_num}) => {
            try {
                
                const result = await get_related_assignments(app_num)
                return result
            }
            catch (err) {
                console.log(err)
                return []
            }
        }
    }
}

module.exports = resolvers

I have confirmed the results provided by the functions that I am importing from the other files they are alright.

Both of the services works fine when they are working alone, i.e problem comes when I try to access the ASSIGNMENT data from the PATENT data or vice-versa.

Please any help is appreciated.

Best Regards,
Aman Negi