code
Provides utility functions for generating code representations of GraphQL types in Markdown format. This module handles the formatting of arguments and fields with proper indentation and deprecation notices.
printCodeArguments()β
function printCodeArguments(type, indentationLevel): string
Defined in: code.ts:39
Generates a string representation of GraphQL arguments with proper formatting and indentation.
Parametersβ
typeβ
unknown
The GraphQL type object containing arguments to print
indentationLevelβ
number
= 1
The level of indentation to apply (default: 1)
Returnsβ
string
A formatted string of arguments or an empty string if no arguments exist
Exampleβ
printCodeArguments({ args: [{ name: 'id', type: 'ID!' }] })
// Returns:
// (
// id: ID!
// )
printCodeField()β
function printCodeField(
type,
options?,
indentationLevel?): string | MDXString
Defined in: code.ts:89
Generates a string representation of a GraphQL field including its arguments, return type, and deprecation status.
Parametersβ
typeβ
unknown
The GraphQL field type object to print
options?β
PrintTypeOptions
Optional configuration for printing the type
indentationLevel?β
number
= 0
The level of indentation to apply (default: 0)
Returnsβ
string
| MDXString
A formatted string representing the field or an empty string if the field should not be printed
Exampleβ
printCodeField({ name: 'user', type: 'User!', args: [{ name: 'id', type: 'ID!' }] })
// Returns: user(
// id: ID!
// ): User!