I have created a custom module for megamenu. I have created the graphQL query for that also. The query returns the correct result for level 0. How can I get the tree structure? Here is my graphql schema.
type Query {
menus(
menuType: String @doc(description: "Defines the filter to use for searching menus")
): Menus @resolver(class: "Test\\MegamenuGraphQl\\Model\\Resolver\\Megamenu") @doc(description: "Retrieves the menus based on filter if filter applied.")
}
type Menus @doc(description: "The collection of menus .") {
items: [Menu] @doc(description: "An array of menuss")
}
type Menu @doc(description: "Contains details about each of the menu.") {
Type: String @doc(description: "The Menu Type")
menu_items: [MenuItems] @doc(description: "The details of menu")
}
type MenuItems @doc(description: "Contains details about each of the menu.") {
menu_id: ID @doc(description: "The menu Id")
title: String @doc(description: "The menu title")
menu_type:String @doc(description: "The menu type")
link: String @doc(description: "The menu link")
image: String @doc(description: "The menu image")
position:ID @doc(description: "The menu position")
parent_id: ID @doc(description: "The parent menu id")
parent_name: String @doc(description: "The parent menu name")
children: [MenuItems] @doc(description: "The details of menu")
}