Last updated

menu

Controls the menu of the GraphQL docs, allowing grouping of queries, mutation, objects, and other elements in the sidebar. Use this option to make a large or complex GraphQL description easier for users to navigate and use.

OptionTypeDescription
groups[Menu groups object]Add top-level groups for different areas of your GraphQL API. Useful for larger GraphQL APIs to add structure to the documentation.
otherItemsGroupNamestringAny items that don't match another group will be added under this group.
requireExactGroupsbooleanRequires every group to be defined. If not, it results in an error. Default: false.
OptionTypeDescription
namestringGroup name.
itemsType group config objectConfiguration for a group of Items.
queriesType group config objectConfiguration for a group of Queries.
mutationsType group config objectConfiguration for a group of Mutations.
subscriptionsType group config objectConfiguration for a group of Subscriptions.
typesType group config objectConfiguration for a group of Types.
directivesType group config objectConfiguration for a group of Directives.

Type group config object

OptionTypeDescription
includeByNamestringJavaScript ECMA-262 regular expression pattern to include in the group by name.
excludeByNamestringJavaScript ECMA-262 regular expression pattern to include in the group by name.

Examples

The following example defines groups for the GraphQL items, and puts everything else under an "Other" entry:

graphql:
  menu:
    requireExactGroups: false
    groups:
      - name: 'Cart'
        items:
          includeByName: ['/cart/i']
      - name: 'Products'
        items:
          includeByName: ['/product/i']
      - name: 'Customer'
        items:
          includeByName: ['/customer/i']
      - name: 'Company'
        items:
          includeByName: ['/company/i']
      - name: 'Gift'
        items:
          includeByName: ['/gift/i']
    otherItemsGroupName: 'Other'

With this configuration in place, the sidebar shows the cart, product, customer, company and gift items under their own sections.

  • graphql - Learn more about using graphql configuration.

Resources