Skip to main content

Custom root types

For custom operation root types (queries not of type Query, or root type name used for other purpose), use the loader option RootTypes:

type RootTypes = { query?: string; mutation?: string; subscription?: string };
  • use a custom type name to override the standard type use an empty string to disable the GraphQL standard type
  • unset root types will use the GraphQL standard type

Add the option rootTypes to the loader options under @graphql-markdown/docusaurus configuration (see also schema loading):

docusaurus.config.js
plugins: [
[
"@graphql-markdown/docusaurus",
/** @type {import('@graphql-markdown/types').ConfigOptions} */
{
// ... other options
loaders: {
GraphQLFileLoader: {
module: "@graphql-tools/graphql-file-loader",
options: {
rootTypes: {
query: "Root", // use custom root type Root for queries, instead of Query
subscription: "" // disable Subscription type
},
},
},
},
},
],
],