AEM graphQL syntax doesn't match graphql documentation? | Community
Skip to main content
Level 8
March 31, 2021
Solved

AEM graphQL syntax doesn't match graphql documentation?

  • March 31, 2021
  • 3 replies
  • 2120 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Christian_Meyer

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). 

3 replies

joerghoh
Adobe Employee
Adobe Employee
April 1, 2021

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

TB3dockAuthor
Level 8
April 3, 2021
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.
Christian_Meyer
Adobe Employee
Christian_MeyerAdobe EmployeeAccepted solution
Adobe Employee
April 8, 2021

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). 

kautuk_sahni
Community Manager
Community Manager
April 8, 2021
@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