code: func LookupPatchMetadataForStruct(t reflect.Type, jsonField string) (
  	elemType reflect.Type, patchStrategies []string, patchMergeKey string, e error) {
  	if t.Kind() == reflect.Ptr {
  		t = t.Elem()
  	}
  
  	if t.Kind() != reflect.Struct {
  		e = fmt.Errorf("merging an object in json but data type is not struct, instead is: %s",
  			t.Kind().String())
  		return
  	}
  	jf := []byte(jsonField)
  	// Find the field that the JSON library would use.
  	var f *field
  	fields := cachedTypeFields(t)
  	for i := range fields {
  		ff := &fields[i]
  		if bytes.Equal(ff.nameBytes, jf) {
  			f = ff
  			break
  		}
  		// Do case-insensitive comparison.
  		if f == nil && ff.equalFold(ff.nameBytes, jf) {
  			f = ff
  		}
  	}
  	if f != nil {
  		// Find the reflect.Value of the most preferential struct field.
  		tjf := t.Field(f.index[0])
  		// we must navigate down all the anonymously included structs in the chain
  		for i := 1; i < len(f.index); i++ {
  			tjf = tjf.Type.Field(f.index[i])
  		}
  		patchStrategy := tjf.Tag.Get(patchStrategyTagKey)
  		patchMergeKey = tjf.Tag.Get(patchMergeKeyTagKey)
  		patchStrategies = strings.Split(patchStrategy, ",")
  		elemType = tjf.Type
  		return
  	}
  	e = fmt.Errorf("unable to find api field in struct %s for the json field %q", t.Name(), jsonField)
  	return
  }
docs: // Finds the patchStrategy and patchMergeKey struct tag fields on a given
  // struct field given the struct type and the JSON name of the field.
  // It returns field type, a slice of patch strategies, merge key and error.
  // TODO: fix the returned errors to be introspectable.