I am having an issue with Content Fragment GraphQL Query.
I have model A which holds a fragment reference to Model B.
Model A has name field and ModelB reference. Model B has a field called category.
I want to get both the result in 1 query like
modelAList{
items{
name
modelBList
{
category
}
}
}
But it gives me syntax error "message": "Validation error (FieldUndefined@ Field 'category' in type 'AllFragmentModels' is undefined",
Solved! Go to Solution.
Hi @ShamliKh ,
The syntax used to reference the fragment in your query is incorrect.
Try the below mentioned syntax
modelAList{
items{
name
modelBList
{
... on ModelBModel{
category
}
}
}
}
Thanks,
Madhur Madan
Hi @ShamliKh ,
The syntax used to reference the fragment in your query is incorrect.
Try the below mentioned syntax
modelAList{
items{
name
modelBList
{
... on ModelBModel{
category
}
}
}
}
Thanks,
Madhur Madan
As Madhur mentioned, the reference syntax you are using needs correction.
You can refer to the sample query from Adobe here