graphkit

package module
v0.0.0-...-0d43376 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateQuery

func ValidateQuery(query string, schema *Schema, config *ValidationConfig) error

ValidateQuery validates a GraphQL query against the provided schema. It checks for unknown fields as well as for possible malicious queries.

Types

type Schema

type Schema struct {
	Raw string

	Types map[string]*nodes.Block `json:"types,omitempty"`

	RootQuery    string `json:"root_query,omitempty"`
	RootMutation string `json:"root_mutation,omitempty"`
}

Schema represents a parsed GraphQL schema.

func LoadSchema

func LoadSchema(rootPath string) (*Schema, error)

LoadSchema loads a GraphQL schema from a directory.

func (*Schema) ResolveType

func (s *Schema) ResolveType(typeName string) (*nodes.Block, error)

ResolveType resolves a type by name

type ValidationConfig

type ValidationConfig struct {
	IgnoreNonExistentTypes   bool
	IgnoreExponentialQueries bool
}

ValidationConfig is used to control which errors are ignored / raised / corrected by the validator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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