introspection

package
v2.0.0-rc.116 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package introspection takes a GraphQL Schema and provides the introspection JSON to fulfill introspection queries.

Index

Constants

View Source
const (
	DeprecatedDirectiveName  = "deprecated"
	DeprecationReasonArgName = "reason"
)
View Source
const (
	// SCALAR is a __TypeKind of type SCALAR.
	SCALAR __TypeKind = iota
	// LIST is a __TypeKind of type LIST.
	LIST
	// NONNULL is a __TypeKind of type NON_NULL.
	NONNULL
	// OBJECT is a __TypeKind of type OBJECT.
	OBJECT
	// ENUM is a __TypeKind of type ENUM.
	ENUM
	// INTERFACE is a __TypeKind of type INTERFACE.
	INTERFACE
	// UNION is a __TypeKind of type UNION.
	UNION
	// INPUTOBJECT is a __TypeKind of type INPUT_OBJECT.
	INPUTOBJECT
)

Variables

View Source
var ErrInvalid__TypeKind = errors.New("not a valid __TypeKind")

Functions

func Parse__TypeKind

func Parse__TypeKind(name string) (__TypeKind, error)

Parse__TypeKind attempts to convert a string to a __TypeKind.

Types

type Data

type Data struct {
	Schema Schema `json:"__schema"`
}

type Directive

type Directive struct {
	Name         string       `json:"name"`
	Description  string       `json:"description"`
	Locations    []string     `json:"locations"`
	Args         []InputValue `json:"args"`
	IsRepeatable bool         `json:"isRepeatable"`
	TypeName     string       `json:"__typename"`
}

func NewDirective

func NewDirective() Directive

type EnumValue

type EnumValue struct {
	Name              string  `json:"name"`
	Description       string  `json:"description"`
	IsDeprecated      bool    `json:"isDeprecated"`
	DeprecationReason *string `json:"deprecationReason"`
	TypeName          string  `json:"__typename"`
}

type Field

type Field struct {
	Name              string       `json:"name"`
	Description       string       `json:"description"`
	Args              []InputValue `json:"args"`
	Type              TypeRef      `json:"type"`
	IsDeprecated      bool         `json:"isDeprecated"`
	DeprecationReason *string      `json:"deprecationReason"`
	TypeName          string       `json:"__typename"`
}

func NewField

func NewField() Field

type FullType

type FullType struct {
	Kind        __TypeKind `json:"kind"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	// not empty for __TypeKind OBJECT and INTERFACE only
	Fields []Field `json:"fields,omitempty"`
	// not empty for __TypeKind INPUT_OBJECT only
	InputFields []InputValue `json:"inputFields"`
	// not empty for __TypeKind OBJECT only
	Interfaces []TypeRef `json:"interfaces"`
	// not empty for __TypeKind ENUM only
	EnumValues []EnumValue `json:"enumValues,omitempty"`
	// not empty for __TypeKind INTERFACE and UNION only
	PossibleTypes []TypeRef `json:"possibleTypes"`
	TypeName      string    `json:"__typename"`
}

func NewFullType

func NewFullType() *FullType

type Generator

type Generator struct {
	Data *Data
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator() *Generator

func (*Generator) Generate

func (g *Generator) Generate(definition *ast.Document, report *operationreport.Report, data *Data)

type InputValue

type InputValue struct {
	Name         string  `json:"name"`
	Description  string  `json:"description"`
	Type         TypeRef `json:"type"`
	DefaultValue *string `json:"defaultValue"`
	TypeName     string  `json:"__typename"`
}

type JsonConverter

type JsonConverter struct {
	// contains filtered or unexported fields
}

func (*JsonConverter) GraphQLDocument

func (j *JsonConverter) GraphQLDocument(introspectionJSON io.Reader) (*ast.Document, error)

type Schema

type Schema struct {
	QueryType        FullType    `json:"queryType"`
	MutationType     *FullType   `json:"mutationType"`
	SubscriptionType *FullType   `json:"subscriptionType"`
	Types            []*FullType `json:"types"`
	Directives       []Directive `json:"directives"`
	TypeName         string      `json:"__typename"`
	// contains filtered or unexported fields
}

func NewSchema

func NewSchema() Schema

func (*Schema) AddType

func (s *Schema) AddType(t *FullType)

func (*Schema) TypeByName

func (s *Schema) TypeByName(name string) *FullType

func (*Schema) TypeNames

func (s *Schema) TypeNames() (query, mutation, subscription string)

type TypeRef

type TypeRef struct {
	Kind     __TypeKind `json:"kind"`
	Name     *string    `json:"name"`
	OfType   *TypeRef   `json:"ofType"`
	TypeName string     `json:"__typename"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL