validator

package
v2.5.31 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 12 Imported by: 139

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Message      = core.Message
	QuotedOrList = core.QuotedOrList
	OrList       = core.OrList
)
View Source
var ErrUnexpectedType = fmt.Errorf("Unexpected Type")
View Source
var Prelude = &ast.Source{
	Name:    "prelude.graphql",
	Input:   preludeGraphql,
	BuiltIn: true,
}

Functions

func AddRule

func AddRule(name string, ruleFunc RuleFunc)

AddRule adds a rule to the rule set. ruleFunc is called once each time `Validate` is executed.

func IsValidFloatString added in v2.4.2

func IsValidFloatString(val reflect.Value, kind reflect.Kind) bool

func IsValidIntString added in v2.4.2

func IsValidIntString(val reflect.Value, kind reflect.Kind) bool

func LoadSchema

func LoadSchema(inputs ...*Source) (*Schema, error)

func RemoveRule added in v2.5.18

func RemoveRule(name string)

RemoveRule removes an existing rule from the rule set if one of the same name exists. The rule set is global, so it is not safe for concurrent changes

func ReplaceRule added in v2.5.21

func ReplaceRule(name string, ruleFunc RuleFunc)

ReplaceRule replaces an existing rule from the rule set if one of the same name exists. If no match is found, it will add a new rule to the rule set. The rule set is global, so it is not safe for concurrent changes

func Validate deprecated

func Validate(schema *Schema, doc *QueryDocument, rules ...Rule) gqlerror.List

Deprecated: use ValidateWithRules instead.

func ValidateSchemaDocument

func ValidateSchemaDocument(sd *SchemaDocument) (*Schema, error)

func ValidateWithRules added in v2.5.29

func ValidateWithRules(schema *Schema, doc *QueryDocument, rules *validatorrules.Rules) gqlerror.List

func VariableValues

func VariableValues(schema *ast.Schema, op *ast.OperationDefinition, variables map[string]interface{}) (map[string]interface{}, error)

VariableValues coerces and validates variable values

func Walk

func Walk(schema *Schema, document *QueryDocument, observers *Events)

Walk is an alias for core.Walk

Types

type AddErrFunc

type AddErrFunc = core.AddErrFunc

type ErrorOption

type ErrorOption = core.ErrorOption

type Events

type Events = core.Events

type Rule added in v2.5.17

type Rule = core.Rule

type RuleFunc added in v2.5.17

type RuleFunc = core.RuleFunc

type Walker

type Walker = core.Walker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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