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
}
}
}
}
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
It is worth noting that the AEM GraphQL API should not be confused with GraphQL itself. The AEM GraphQL API was not fully developed and some features, such as Mutations, Subscriptions, and Paging/Sorting, were still in progress at the time. Unfortunately, I am uncertain if this behavior is intentional or not.
It is worth noting that the AEM GraphQL API should not be confused with GraphQL itself. The AEM GraphQL API was not fully developed and some features, such as Mutations, Subscriptions, and Paging/Sorting, were still in progress at the time. Unfortunately, I am uncertain if this behavior is intentional or not.
Is it yet to be made available in AEM, can someone please confirm ?
Views
Replies
Total Likes
Views
Likes
Replies