code: func VariablesAreInputTypesRule(context *ValidationContext) *ValidationRuleInstance {
  
  	visitorOpts := &visitor.VisitorOptions{
  		KindFuncMap: map[string]visitor.NamedVisitFuncs{
  			kinds.VariableDefinition: {
  				Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
  					if node, ok := p.Node.(*ast.VariableDefinition); ok && node != nil {
  						ttype, _ := typeFromAST(*context.Schema(), node.Type)
  
  						// If the variable type is not an input type, return an error.
  						if ttype != nil && !IsInputType(ttype) {
  							variableName := ""
  							if node.Variable != nil && node.Variable.Name != nil {
  								variableName = node.Variable.Name.Value
  							}
  							reportError(
  								context,
  								fmt.Sprintf(`Variable "$%v" cannot be non-input type "%v".`,
  									variableName, printer.Print(node.Type)),
  								[]ast.Node{node.Type},
  							)
  						}
  					}
  					return visitor.ActionNoChange, nil
  				},
  			},
  		},
  	}
  	return &ValidationRuleInstance{
  		VisitorOpts: visitorOpts,
  	}
  }
docs: // VariablesAreInputTypesRule Variables are input types
  //
  // A GraphQL operation is only valid if all the variables it defines are of
  // input types (scalar, enum, or input object).