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",
loaders: {
GraphQLFileLoader: "@graphql-tools/graphql-file-loader",
},
groupByDirective: {
directive: "doc",
field: "category",
fallback: "Common"
},
docOptions: {
index: true,
},
printTypeOptions: {
deprecated: "group",
exampleSection: true,
parentTypePrefix: false,
relatedTypeSection: false,
typeBadges: true,
hierarchy: "entity",
},
skipDocDirective: ["@noDoc"],
customDirective: {
auth: {
descriptor: (directive, type) =>
directiveDescriptor(
directive,
type,
"This requires the current user to be in `${requires}` role.",
),
},
beta: {
tag: (directive) => ({
text: directive?.name?.toUpperCase(),
classname: "badge--danger",
}),
},
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 9/6/2024, 5:47:43 PM.