I have the fallowing schema.graphql:
union MyClass0 = MyClass2 | MyClass
extend type Query {
my_TEST: [MyClass0] @resolve
}
And also the fallowing main.js (just for test):
const MyClass = Parse.Object.extend('MyClass')
let myClass = new MyClass()
myClass.set('name', 'John')
myClass.set('age', 30)
myClass.save()
const MyClass2 = Parse.Object.extend('MyClass2')
let myClass2 = new MyClass2()
myClass2.set('name_new', 'Maria')
myClass2.set('age_new', 54)
myClass2.save()
Parse.Cloud.define('my_TEST', async (req) => {
const query = new Parse.Query("MyClass");
const results = await query.find();
const query2 = new Parse.Query("MyClass2");
const results2 = await query2.find();
return [...results, ...results2];
});
Also this is the query that I am trying to run:
{
my_TEST {
__typename
... on MyClass{
name
}
... on MyClass2{
age_new
}
}
}
And this is my error message that I get:
"Abstract type \"MyClass0\" must resolve to an Object type at runtime for field \"Query.my_TEST\". Either the \"MyClass0\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function."
Does anyone know how can I add the resolveType in order to make it see my resolvers, or I am supposed to do this differently?
What I’ve tried:
Option 1:
trying to add a Parse.Cloud.beforeFind for my_TEST and MyClass0 but non of them worked.
Option 2:
trying to follow this repo but is outdated for about 5 years and I could not make it work.
Option 3:
I’ve also read the documentation from here but I could not find anything usefull
Can anyone point me in the right direction? I am really out of ideas.