package formatter

import "github.com/vektah/gqlparser/v2/formatter"

Index

Types

type Formatter

type Formatter interface {
	FormatSchema(schema *ast.Schema)
	FormatSchemaDocument(doc *ast.SchemaDocument)
	FormatQueryDocument(doc *ast.QueryDocument)
}

func NewFormatter

func NewFormatter(w io.Writer, options ...FormatterOption) Formatter

type FormatterOption

type FormatterOption func(*formatter)

func WithBuiltin

func WithBuiltin() FormatterOption

WithBuiltin includes builtin fields/directives/etc from the source/AST in the formatted output.

func WithComments

func WithComments() FormatterOption

WithComments includes comments from the source/AST in the formatted output.

func WithCompacted

func WithCompacted() FormatterOption

WithCompacted enables compacted output, which removes all unnecessary whitespace.

func WithIndent

func WithIndent(indent string) FormatterOption

WithIndent uses the given string for indenting block bodies in the output, instead of the default, `"\t"`.

func WithoutDescription

func WithoutDescription() FormatterOption

WithoutDescription excludes GQL description from the source/AST in the formatted output.

Source Files

formatter.go

Version
v2.5.27 (latest)
Published
May 7, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
14 hours ago

Tools for package owners.