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 the GraphQL-Markdown configuration (see also schema loading):

.graphqlrc
schema: ./schema.graphql
extensions:
graphql-markdown:
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