Skip to main content

Schema Documentation

This is an example of documentation grouping with GraphQL directive using the groupByDirective option (see documentation):

{
schema: "data/schema_with_grouping.graphql",
baseURL: ".",
linkRoot: "/examples/group-by",
homepage: "data/groups.md",
groupByDirective: {
directive: "doc",
field: "category",
fallback: "Common"
},
docOptions: {
index: true,
},
printTypeOptions: {
deprecated: "group",
exampleSection: true,
parentTypePrefix: false,
relatedTypeSection: false,
typeBadges: true,
useApiGroup: false,
},
skipDocDirective: ["@noDoc"],
customDirective: {
auth: {
descriptor: (directive, type) =>
directiveDescriptor(
directive,
type,
"This requires the current user to be in `${requires}` role.",
),
},
complexity: {
descriptor: (directive, type) => {
const { value, multipliers } = getTypeDirectiveValues(directive, type);
const multiplierDescription = multipliers
? ` per ${multipliers.map((v) => `\`${v}\``).join(", ")}`
: "";
return `This has an additional cost of \`${value}\` points${multiplierDescription}.`;
},
},
},
}
Generated on 3/1/2024, 2:53:01 PM.