i am using Adobe AEM with GraphQL and i am trying to use Fragments here (because i want to query the data with Gatsby.js, but this is not related i think).
When i try to run this Query:
{
testList {
items {
typename
headline
}
}
}
the result is
{
"data": {
"testList": {
"items": [
{
"__typename": "TestModel",
"headline": "test headline"
},
{
"__typename": "TestModel",
"headline": "Test headline two"
}
]
}
}
}
which looks fine.. BUT when i try to query with fragments, the field is getting no data (headline is null)
{
testList {
items {
__typename
...TestModelFragment
}
}
}
fragment TestModelFragment on TestModel {
headline
}
{
"data": {
"testList": {
"items": [
{
"__typename": "TestModel",
"headline": null
},
{
"__typename": "TestModel",
"headline": null
}
]
}
}
}
can someone explain this or am i missing something here?