introspection

package
v1.67.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 11 Imported by: 2

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

This section is empty.

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"`
}

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"`
}

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"`
}

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"`
	// 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"`
	// not empty for __TypeKind INTERFACE and UNION only
	PossibleTypes []TypeRef `json:"possibleTypes"`
}

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"`
}

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        *TypeName   `json:"queryType"`
	MutationType     *TypeName   `json:"mutationType"`
	SubscriptionType *TypeName   `json:"subscriptionType"`
	Types            []FullType  `json:"types"`
	Directives       []Directive `json:"directives"`
}

func NewSchema

func NewSchema() Schema

func (*Schema) TypeNames

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

type TypeName

type TypeName struct {
	Name string `json:"name"`
}

type TypeRef

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

Jump to

Keyboard shortcuts

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