GraphQL implementing custom resolver field

Hello,
I'm trying out GraphQL. I can use the generated resolvers using Neo4j 3.15 without any issues. I'm now trying to create a custom resolver field based on this article Neo4j GraphQL Library - Neo4j GraphQL Library

I defined the resolver as below in the graphql-schema.js file:

export const resolvers = {
Test_User: {
fullDescription(object, params, ctx, resolveInfo) {
return ${object.description1} - ${object.description2};
}
}
};

and the type as follow in the schema.graphql. 'fullDescription' is a new resolver field not defined in Neo4j

type Test_User {
id: ID!
name: String
description1: String
description2: String
fullDescription: String
}

The query returns 'undefined' for the object parameter:

{
"data": {
"Test_User": [
{
"fullDescription": "undefined - undefined"
}
]
}
}

What am I doing wrong?

Thanks

This is returning undefined as the object parameter of resolver function has all the properties of it's parent field that are also part of the query. Since in your case neither description1 nor description2 are part of the query so the object doesn't have these properties. You can print on console this object inside the resolver to know what field it holds.
export const resolvers = {
Test_User: {
fullDescription(object, params, ctx, resolveInfo) {
console.log(object);
return ${object.description1} - ${object.description2} ;
}
}
};