relation
This module provides functionality to print relationships between GraphQL types, including return types, member fields, and implementations, in a formatted MDX string output.
getRootTypeLocaleFromString()β
function getRootTypeLocaleFromString(text): Maybe<TypeLocale>
Defined in: relation.ts:40
Converts a string representation of a root type to its corresponding TypeLocale
Parametersβ
textβ
string
The string to convert to a TypeLocale
Returnsβ
Maybe
<TypeLocale
>
The matching TypeLocale if found, undefined otherwise
Exampleβ
const locale = getRootTypeLocaleFromString('Query');
printRelationOf()β
function printRelationOf<T>(
type,
section,
getRelation,
options): string | MDXString
Defined in: relation.ts:65
Prints the relation section for a specific type and relation category
Type Parametersβ
Tβ
T
Type of the relation
Parametersβ
typeβ
unknown
The GraphQL type to get relations for
sectionβ
unknown
The section title for the relation
getRelationβ
Maybe
<IGetRelation
<T
>>
Function to retrieve relations of type T
optionsβ
PrintTypeOptions
Printing options for type formatting
Returnsβ
string
| MDXString
Formatted MDX string containing the relations or empty string if no relations found
Throwsβ
If the schema is not provided in options
Exampleβ
const mdx = printRelationOf(type, "Member Of", getRelationOfField, options);
printRelations()β
function printRelations(type, options): string | MDXString
Defined in: relation.ts:134
Prints all relations (return types, member fields, and implementations) for a given type
Parametersβ
typeβ
unknown
The GraphQL type to get all relations for
optionsβ
PrintTypeOptions
Printing options for type formatting
Returnsβ
string
| MDXString
Formatted MDX string containing all relations or empty string if no relations found
Throwsβ
If the schema is not provided in options
Exampleβ
const relations = printRelations(myType, { schema, formatMDXBullet: () => "* " });