GraphQL Fragments Result in Null
Hello, I was testing GraphQL Fragments https://graphql.org/learn/queries/#fragments in the Headless Demo on Cloud and noticed that they don't allow for any data to be returned. The _path returns, but ONLY if it is also listed under "item" as well. All the other fields return null. It doesn't seem that GraphQL fragments work. Is this a bug?
{
adventureByPath(
_path: "/content/dam/aem-demo-assets/en/adventures/bali-surf-camp/bali-surf-camp"
) {
item {
doda:_path
...adventure
}
}
}
fragment adventure on AdventureModel {
_path
title
description {
json
}
primaryImage {
... on ImageRef {
_path
width
height
}
}
}
The output
{
"data": {
"adventureByPath": {
"item": {
"doda": "/content/dam/aem-demo-assets/en/adventures/bali-surf-camp/bali-surf-camp",
"_path": "/content/dam/aem-demo-assets/en/adventures/bali-surf-camp/bali-surf-camp",
"title": null,
"description": null,
"primaryImage": null
}
}
}
}