I have a Custom GraphQL resolver. A GraphQL mutation mapped to a MongoDB function. This function shall return two Objects. Both objects already exist in my GraphQL schema. How can I reference the already existing objects in my GraphQL schema?
{
"type": "object",
"title": "MyCustomMutationResult",
"properties": {
"team": { "$ref": "/schema/Team"},
"user": { "$ref": "/schema/User"}
}
}
This is the same question. The post sais this is solved. But not quite.
It is possible to select one existing GraphQL object as a return type (“payload type”) of the custom resolver But how can I return severl existing objects in my custom return type? How can I reference them? Something like #/realm/mongodb-atlas/Team
?
The only way I found so far is to redefine all return objects (Team and User) with all their propoerties. This basically works but is a crude hack. It duplictes all objects in my GraphQL schema.