Documentation categories
You can group the documentation to provide an easier user experience to navigate. This is accomplished by adding a directive to all the types you want to have grouped.
For example, we have two mutations called addCourse and dropCourse, and we want to group them under a category called Courses.
type Mutation {
AddCourse(input: String): String
DropCourse(input: String): String
}
Usage
We can accomplish this by adding a directive called doc with a field category to each mutation.
type Mutation {
AddCourse(input: String): String @doc(category: "Course")
DropCourse(input: String): String @doc(category: "Course")
}
We can add a fallback option called Common which is for types that we don't explicitly add a directive to.
It can be set either with the command line flag --groupByDirective:
npx gqlmd graphql-to-doc --groupByDirective "@doc(category|=Common)"
or the configuration option groupByDirective:
.graphqlrc
schema: ./schema.graphql
extensions:
graphql-markdown:
groupByDirective:
directive: "doc"
field: "category"
fallback: "Common" # default is Miscellaneous