Expand my Community achievements bar.

SOLVED

AEM graphQL syntax doesn't match graphql documentation?

Avatar

Level 9

According to pretty much all graphql documentation (read: first 3 pages of google search)

I should be able to use syntax like:

{
  hero {
      name
   }
}

and

{
   human(id: "1000") {
      name
     height
  }
}

 

The first page of https://graphql.org/ has examples like:

{
  project(name: "GraphQL") {
     tagline
  }
}

However, this syntax, and the majority of the grapql features, simply don't work with AEM for some unknown reason.

 

AEM wknd has an Content Fragment Model called Adventure with fields with the following property names:

  • adventureTitle
  • adventureType
  • etc. 

So I should be able to do this:

  Adventure {

      adventureTitle

  }

}

 

But this doesnt work. The only thing which works is something like:

 

{
  adventureList {
      items {
         adventureType
         adventureTitle
         adventurePrice
         adventureActivity
   }
}

Its using a syntax which doesnt seem to be mentioned in any grapql documentation outside of AEM.

 

named queries, string comparisons, static parameters, all the documented features and syntax of graphql doesnt seem to work with graphql on AEM.

 

Is it using its own dialect?

1 Accepted Solution

Avatar

Correct answer by
Employee

I believe there's no standard syntax for what we call the "top level functions" - so we decided to go with "adventureList" & "adventureByPath" to be more explicit with the query names.

On the other side, the intermediate "item" and "items" nodes were created to allow the introduction of sibling properties that would be common to all models (like "_references", which contains the hydrated content & fragment references). 

View solution in original post

8 Replies

Avatar

Employee Advisor

The Adobe documentation mentions on https://experienceleague.adobe.com/docs/experience-manager-cloud-service/assets/admin/graphql-api-co... that the used library is the one from graphql.org, so I don't think that this is an Adobe dialect.

Avatar

Level 9
The strange thing is that the syntax required by graphql endpoint in AEM, is completely different to that used everywhere else for graphql. None of sytax on the graphql.org site works with AEM. It seems to have a completely different syntax than anything else. As Adobe only give a few examples of their syntax, it is largely undocumented, so we cant do anything more than the most basic searches and filters.

Avatar

Employee Advisor
Thanks @TB3dock for your input, I am checking back internally and hope to provide a meaningful response soon.

Avatar

Correct answer by
Employee

I believe there's no standard syntax for what we call the "top level functions" - so we decided to go with "adventureList" & "adventureByPath" to be more explicit with the query names.

On the other side, the intermediate "item" and "items" nodes were created to allow the introduction of sibling properties that would be common to all models (like "_references", which contains the hydrated content & fragment references). 

Avatar

Administrator
@Christian_Meyer, Thank you for sharing your thoughts with AEM community. Looking forward to your more contribution in the Community. We need great SMEs like you in the AEM community. Thank you so much.


Kautuk Sahni

Avatar

Level 9
The problem is that this new syntax is not documented, and is radically different from every other graphql implementation. We have not been able to find the right syntax do to the kind of filtering we need, and is trivial for "standard" graphql syntax.

Avatar

Employee

For reference, the documentation page https://experienceleague.adobe.com/docs/experience-manager-cloud-service/assets/admin/content-fragme... provides examples of basic queries and how the syntax should look like.

On top of that, the GraphiQL user interface (https://experienceleague.adobe.com/docs/experience-manager-cloud-service/assets/admin/graphql-api-co...) also provides a schema explorer which helps understanding the structure of the schemas.