code: func LoneAnonymousOperationRule(context *ValidationContext) *ValidationRuleInstance {
  	var operationCount = 0
  	visitorOpts := &visitor.VisitorOptions{
  		KindFuncMap: map[string]visitor.NamedVisitFuncs{
  			kinds.Document: {
  				Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
  					if node, ok := p.Node.(*ast.Document); ok {
  						operationCount = 0
  						for _, definition := range node.Definitions {
  							if definition.GetKind() == kinds.OperationDefinition {
  								operationCount++
  							}
  						}
  					}
  					return visitor.ActionNoChange, nil
  				},
  			},
  			kinds.OperationDefinition: {
  				Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
  					if node, ok := p.Node.(*ast.OperationDefinition); ok {
  						if node.Name == nil && operationCount > 1 {
  							reportError(
  								context,
  								`This anonymous operation must be the only defined operation.`,
  								[]ast.Node{node},
  							)
  						}
  					}
  					return visitor.ActionNoChange, nil
  				},
  			},
  		},
  	}
  	return &ValidationRuleInstance{
  		VisitorOpts: visitorOpts,
  	}
  }
docs: // LoneAnonymousOperationRule Lone anonymous operation
  //
  // A GraphQL document is only valid if when it contains an anonymous operation
  // (the query short-hand) that it contains only that one operation definition.