Skip to main content

operation

Module for handling GraphQL operation printing functionality. Provides utilities to print operation types, metadata, and code representations.

printCodeOperation()​

const printCodeOperation: (type, options?, indentationLevel) => string | MDXString = printCodeField;

Defined in: graphql/operation.ts:57

Prints the code representation of an operation.

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!

See​

printCodeField


printOperationMetadata()​

function printOperationMetadata(type, options): string | MDXString

Defined in: graphql/operation.ts:39

Prints the operation metadata including arguments and type information.

Parameters​

type​

unknown

The operation type to print metadata for

options​

PrintTypeOptions

Print type options for customizing output

Returns​

string | MDXString

Formatted string containing operation metadata or empty string if invalid


printOperationType()​

function printOperationType(type, options): string | MDXString

Defined in: graphql/operation.ts:18

Prints the operation type information.

Parameters​

type​

unknown

The operation type to print

options​

PrintTypeOptions

Print type options for customizing output

Returns​

string | MDXString

Formatted string representation of the operation type or empty string if invalid