func (ctx *Context) VariableUsages(def *ast.ExecutableDefinition) []string {
	return ctx.variableUsages[def]
}
VariableUsages returns the variable usages in an operation or fragment definition.
package validation
import (
	"github.com/bucketd/go-graphqlparser/ast"
	"github.com/bucketd/go-graphqlparser/graphql"
)
var (
	queryContextDecoratorWalker = NewWalker([]VisitFunc{
		setFragments,
		setExecutableDefinition,
		setReferencedFragments,
		setVariableUsages,
	})
)
func NewContext(doc ast.Document, schema *graphql.Schema) *Context {
	if schema == nil {
		schema = &graphql.Schema{}
	}
	ctx := &Context{
		Document: doc,
		Schema:   schema,
	}
	queryContextDecoratorWalker.Walk(ctx, doc)
	return ctx
}
func NewSDLContext(doc ast.Document, schema *graphql.Schema) *Context {
	isExtending := schema != nil
	if !isExtending {
		schema = &graphql.Schema{}
	}
	ctx := &Context{
		Document: doc,
		Schema:   schema,
	}
	ctx.SDLContext = &SDLContext{
		IsExtending: isExtending,
	}
	PrepareContextSDL(ctx)
	return ctx
}
type Context struct {
	Document ast.Document
	Errors   *graphql.Errors
	Schema   *graphql.Schema
	SDLContext *SDLContext
	OperationDefinitions map[string]*ast.OperationDefinition
	FragmentDefinitions map[string]*ast.FragmentDefinition
	referencedFragments map[*ast.ExecutableDefinition][]ast.Definition
	variableUsages map[*ast.ExecutableDefinition][]string
	executableDefinition *ast.ExecutableDefinition
}
func (ctx *Context) AddError(err graphql.Error) {
	ctx.Errors = ctx.Errors.Add(err)
}
func (ctx *Context) DirectiveDefinition(name string) (*ast.DirectiveDefinition, bool) {
	var dirDef *ast.DirectiveDefinition
	var isInSchema bool
	if ctx.SDLContext.IsExtending {
		dirDef, isInSchema = ctx.Schema.Directives[name]
	}
	if !isInSchema {
		dirDef = ctx.SDLContext.DirectiveDefinitions[name]
	}
	if dirDef == nil {
		dirDef = graphql.SpecifiedDirectives()[name]
	}
	return dirDef, isInSchema
}
func (ctx *Context) Fragment(name string) *ast.FragmentDefinition {
	return ctx.FragmentDefinitions[name]
}
func (ctx *Context) TypeDefinition(name string) (*ast.TypeDefinition, bool) {
	var typeDef *ast.TypeDefinition
	var isInSchema bool
	if ctx.SDLContext.IsExtending {
		typeDef, isInSchema = ctx.Schema.Types[name]
	}
	if !isInSchema {
		typeDef = ctx.SDLContext.TypeDefinitions[name]
	}
	return typeDef, isInSchema
}