code: func FieldsOnCorrectTypeRule(context *ValidationContext) *ValidationRuleInstance {
  	visitorOpts := &visitor.VisitorOptions{
  		KindFuncMap: map[string]visitor.NamedVisitFuncs{
  			kinds.Field: {
  				Kind: func(p visitor.VisitFuncParams) (string, interface{}) {
  					var action = visitor.ActionNoChange
  					if node, ok := p.Node.(*ast.Field); ok {
  						var ttype Composite
  						if ttype = context.ParentType(); ttype == nil {
  							return action, nil
  						}
  						switch ttype.(type) {
  						case *Object, *Interface, *Union:
  							if reflect.ValueOf(ttype).IsNil() {
  								return action, nil
  							}
  						}
  						fieldDef := context.FieldDef()
  						if fieldDef == nil {
  							// This field doesn't exist, lets look for suggestions.
  							var nodeName string
  							if node.Name != nil {
  								nodeName = node.Name.Value
  							}
  							// First determine if there are any suggested types to condition on.
  							suggestedTypeNames := getSuggestedTypeNames(context.Schema(), ttype, nodeName)
  
  							// If there are no suggested types, then perhaps this was a typo?
  							suggestedFieldNames := []string{}
  							if len(suggestedTypeNames) == 0 {
  								suggestedFieldNames = getSuggestedFieldNames(context.Schema(), ttype, nodeName)
  							}
  							reportError(
  								context,
  								UndefinedFieldMessage(nodeName, ttype.Name(), suggestedTypeNames, suggestedFieldNames),
  								[]ast.Node{node},
  							)
  						}
  					}
  					return action, nil
  				},
  			},
  		},
  	}
  	return &ValidationRuleInstance{
  		VisitorOpts: visitorOpts,
  	}
  }
docs: // FieldsOnCorrectTypeRule Fields on correct type
  //
  // A GraphQL document is only valid if all fields selected are defined by the
  // parent type, or are an allowed meta field such as __typenamme