GraphQL – Categories with entries

Is it possible to get categories with related entries with one graphQL query?

I have the following query:

query MyQuery {
  categories(relatedToEntries: {section: "entryType"}) {
    id
    title
  }
}

Giving me this result:

{
  "data": {
    "categories": [
      {
        "id": "253",
        "title": "Category One"
      },
      {
        "id": "257",
        "title": "Category Two"
      }
    ]
  }
}

I would like something like the following:

{
  "data": {
    "categories": [
      {
        "id": "253",
        "title": "Category One",
        "entries": [
           {
              "id": 1,
              "title": "Title"
         }
      },
      {
        "id": "257",
        "title": "Category Two",
        "entries": [
           {
              "id": 1,
              "title": "Title"
         }
    ]
  }


}

 

Read more here: Source link