validator

package
v0.0.0-...-5d34579 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message   string
	Locations []Location
	// contains filtered or unexported fields
}

func CoerceArgumentValues

func CoerceArgumentValues(node ast.Node, argumentDefinitions map[string]*schema.InputValueDefinition, arguments []*ast.Argument, variableValues map[string]interface{}) (map[string]interface{}, *Error)

func CoerceVariableValues

func CoerceVariableValues(s *schema.Schema, features schema.FeatureSet, operation *ast.OperationDefinition, variableValues map[string]interface{}) (map[string]interface{}, *Error)

func ValidateDocument

func ValidateDocument(doc *ast.Document, s *schema.Schema, features schema.FeatureSet, additionalRules ...Rule) []*Error

func (*Error) Error

func (err *Error) Error() string

type Location

type Location struct {
	Line   int
	Column int
}

type Rule

func ValidateCost

func ValidateCost(operationName string, variableValues map[string]interface{}, max int, actual *int, defaultCost schema.FieldCost) Rule

Calculates the cost of the given operation and ensures it is not greater than max. If max is -1, no limit is enforced. If actual is non-nil, it is set to the actual cost of the operation. Queries with costs that are too high to calculate due to overflows always result in an error when max is non-negative, and actual will be set to the maximum possible value.

type TypeInfo

type TypeInfo struct {
	SelectionSetTypes       map[*ast.SelectionSet]schema.NamedType
	VariableDefinitionTypes map[*ast.VariableDefinition]schema.Type
	FieldDefinitions        map[*ast.Field]*schema.FieldDefinition
	ExpectedTypes           map[ast.Value]schema.Type
	DefaultValues           map[ast.Value]interface{}
}

func NewTypeInfo

func NewTypeInfo(doc *ast.Document, s *schema.Schema, features schema.FeatureSet) *TypeInfo

Jump to

Keyboard shortcuts

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