Hi
i have a problem with union but problem has been solved by change

to

at first node query return empty object, but fixed bug by above 馃樂

{
node(id: "VHJlZTo2NTc4NDI3NjUyNjcxMTcyNjA4") {
... on Tree {
id
version
}
}
}
Maybe cuz in my class @ObjectType not placing a name 馃
Maybe cuz in my class @ObjectType not placing a name 馃
it's not
Once again - what is the problem? Can you show me your object type classes or create a minimal reproducible code example repository? :confused:
maybe my dictation not very right
let me say it again:
with code in img1, graphql server return "{"node":{}}" ( an empty object )
then i has changed to img2, graphql server return as expected
so i said "maybe a bug with returnType function"
Covered by tests:
Please create a repository with a minimal reproducible code example.
I have created a repo: https://github.com/quaj/reproduce-bug-type-graphql
guess this bug come with typegoose, tested regular class then nothing happend
Query test:
{
node(id: "5d5da8ace13a526cf80fc264") {
... on Tree {
version
}
}
}
Case tested:
convert model to regular object with node.toObject() but can't fixes
Cannot reproduce:
# Write your query or mutation here
{
node(id: "5d602b0caf25c15fa0f7fe67") {
... on Tree {
version
}
... on Repo {
source_id
}
}
}
{
"data": {
"node": {
"source_id": "test"
}
}
}
It will return node: {} when the returned type is not covered by the ... on fragment syntax for this type.
sorry my bad, at first i covered with fragment but it's fragement of Tree so it return not correct
dont know why but in my production code bug still happened but in reproduce code is not


i can't move all source of production to reproduce this bug
anyway problem solved to me
many thanks @19majkel94, sorry for taking your time
Ah sorry, wrong screenshot
