renderer
Rendererβ
Defined in: renderer.ts:211
Use Declared Type
Core renderer class responsible for generating documentation files from GraphQL schema entities. Handles the conversion of schema types to markdown/MDX documentation with proper organization.
Exampleβ
Constructorsβ
Constructorβ
new Renderer(
printer,
outputDir,
baseURL,
group,
prettify,
docOptions,
mdxModule?): Renderer
Defined in: renderer.ts:234
Creates a new Renderer instance.
Parametersβ
printerβ
typeof IPrinter
The printer instance used to convert GraphQL types to markdown
outputDirβ
string
Directory where documentation will be generated
baseURLβ
string
Base URL for the documentation
groupβ
Maybe
<Partial
<Record
<SchemaEntity
, Record
<string
, Maybe
<string
>>>>>
Optional grouping configuration for schema entities
prettifyβ
boolean
Whether to format the generated markdown
docOptionsβ
Maybe
<RendererDocOptions
>
Additional documentation options
mdxModule?β
unknown
Optional MDX module for enhanced documentation features
Returnsβ
Exampleβ
Propertiesβ
baseURLβ
baseURL: string;
Defined in: renderer.ts:214
groupβ
group: Maybe<Partial<Record<SchemaEntity, Record<string, Maybe<string>>>>>;
Defined in: renderer.ts:212
mdxModuleβ
mdxModule: unknown;
Defined in: renderer.ts:217
mdxModuleIndexFileSupportβ
mdxModuleIndexFileSupport: boolean;
Defined in: renderer.ts:218
optionsβ
options: Maybe<RendererDocOptions>;
Defined in: renderer.ts:216
outputDirβ
outputDir: string;
Defined in: renderer.ts:213
prettifyβ
prettify: boolean;
Defined in: renderer.ts:215
Methodsβ
generateCategoryMetafileType()β
generateCategoryMetafileType(
type,
name,
rootTypeName): Promise<string>
Defined in: renderer.ts:318
Use Declared Type
Generates the directory path and metafiles for a specific schema entity type. Creates the appropriate directory structure based on configuration options.
Parametersβ
typeβ
unknown
The schema entity type
nameβ
string
The name of the schema entity
rootTypeNameβ
SchemaEntity
The root type name this entity belongs to
Returnsβ
Promise
<string
>
The generated directory path
Exampleβ
generateIndexMetafile()β
generateIndexMetafile(
dirPath,
category,
options): Promise<void>
Defined in: renderer.ts:290
Use Declared Type
Generates an index metafile for a category directory if MDX support is available.
Parametersβ
dirPathβ
string
The directory path where the index should be created
categoryβ
string
The category name
optionsβ
CategoryMetafileOptions
= ...
Configuration options for the index
Returnsβ
Promise
<void
>
Promise that resolves when the index is generated
Exampleβ
await renderer.generateIndexMetafile('docs/types', 'Types', {
collapsible: true,
collapsed: false
});
hasMDXIndexFileSupport()β
hasMDXIndexFileSupport(module): module is Partial<MDXSupportType> & Pick<MDXSupportType, "generateIndexMetafile">
Defined in: renderer.ts:261
Use Declared Type
Checks if the provided module supports MDX index file generation.
Parametersβ
moduleβ
unknown
= ...
The module to check for MDX support
Returnsβ
module is Partial<MDXSupportType> & Pick<MDXSupportType, "generateIndexMetafile">
True if the module supports index metafile generation
Exampleβ
renderHomepage()β
renderHomepage(homepageLocation): Promise<void>
Defined in: renderer.ts:494
Use Declared Type
Renders the homepage for the documentation from a template file. Replaces placeholders in the template with actual values.
Parametersβ
homepageLocationβ
string
Path to the homepage template file
Returnsβ
Promise
<void
>
Promise that resolves when the homepage is rendered
Exampleβ
renderRootTypes()β
renderRootTypes(rootTypeName, type): Promise<Maybe<Maybe<Category>[]>>
Defined in: renderer.ts:380
Use Declared Type
Renders all types within a root type category (e.g., all Query types).
Parametersβ
rootTypeNameβ
SchemaEntity
The name of the root type (e.g., "Query", "Mutation")
typeβ
unknown
The type object containing all entities to render
Returnsβ
Promise
<Maybe
<Maybe
<Category
>[]>>
Array of rendered categories or undefined
Exampleβ
renderTypeEntities()β
renderTypeEntities(
dirPath,
name,
type): Promise<Maybe<Category>>
Defined in: renderer.ts:424
Use Declared Type
Renders documentation for a specific type entity and saves it to a file.
Parametersβ
dirPathβ
string
The directory path where the file should be saved
nameβ
string
The name of the type entity
typeβ
unknown
The type entity to render
Returnsβ
Promise
<Maybe
<Category
>>
The category information for the rendered entity or undefined
Exampleβ
CategoryMetafileOptionsβ
Defined in: renderer.ts:198
Use Declared Type
Configuration options for category metafiles in the documentation. These options control the appearance and behavior of category sections in the sidebar.
CategoryMetafileOptions
Exampleβ
const options: CategoryMetafileOptions = {
collapsible: true,
collapsed: false,
sidebarPosition: SidebarPosition.FIRST,
styleClass: CATEGORY_STYLE_CLASS.API
};
Propertiesβ
collapsed?β
optional collapsed: boolean;
Defined in: renderer.ts:200
Whether the category should be initially collapsed
collapsible?β
optional collapsible: boolean;
Defined in: renderer.ts:199
Whether the category should be collapsible in the sidebar
sidebarPosition?β
optional sidebarPosition: number;
Defined in: renderer.ts:201
Custom position in the sidebar (lower numbers appear first)
styleClass?β
optional styleClass: string;
Defined in: renderer.ts:202
CSS class to apply to the category for styling
API_GROUPSβ
const API_GROUPS: Required<ApiGroupOverrideType>;
Defined in: renderer.ts:118
Use Declared Type
Default group names for API types and non-API types. This constant provides the base folder structure for organizing GraphQL schema entities. Can be overridden via ApiGroupOverrideType in configuration.
Exampleβ
// Default structure
const defaultGroups = API_GROUPS;
// { operations: "operations", types: "types" }
// With custom override
const customGroups = { ...API_GROUPS, operations: "queries-and-mutations" };
Seeβ
getApiGroupFolder For usage with type categorization
getApiGroupFolder()β
function getApiGroupFolder(type, groups?): string
Defined in: renderer.ts:140
Use Declared Type
Determines the appropriate folder for a GraphQL schema entity based on its type.
Parametersβ
typeβ
unknown
The GraphQL schema entity to categorize
groups?β
Maybe
<boolean
| ApiGroupOverrideType
>
Optional custom group naming configuration
Returnsβ
string
The folder name where the entity should be placed
Exampleβ
// With default groups
const folder = getApiGroupFolder(queryType); // Returns "operations"
// With custom groups
const folder = getApiGroupFolder(objectType, { operations: "queries" }); // Returns appropriate folder
getRenderer()β
function getRenderer(
printer,
outputDir,
baseURL,
group,
prettify,
docOptions,
mdxModule?): Promise<Renderer>
Defined in: renderer.ts:558
Use Declared Type
Factory function to create and initialize a Renderer instance. Creates the output directory and returns a configured renderer.
Parametersβ
printerβ
typeof IPrinter
The printer instance to use for rendering types
outputDirβ
string
The output directory for generated documentation
baseURLβ
string
The base URL for the documentation
groupβ
Maybe
<Partial
<Record
<SchemaEntity
, Record
<string
, Maybe
<string
>>>>>
Optional grouping configuration
prettifyβ
boolean
Whether to prettify the output markdown
docOptionsβ
Maybe
<RendererDocOptions
>
Additional documentation options
mdxModule?β
unknown
Optional MDX module for enhanced features
Returnsβ
Promise
<Renderer
>
A configured Renderer instance
Exampleβ
const renderer = await getRenderer(
myPrinter,
'./docs',
'/api',
groupConfig,
true,
{ force: true, index: true }
);