code: func newFieldDef(apiDef *raml.APIDefinition, structName string, prop raml.Property, pkg string) fieldDef {
  	var (
  		fieldType = prop.TypeString()               // the field type
  		basicType = commons.GetBasicType(fieldType) // basic type of the field type
  	)
  
  	// for the types, check first if it is user defined type
  	if _, ok := apiDef.Types[basicType]; ok {
  		titledType := strings.Title(basicType)
  
  		// check if it is a recursive type
  		if titledType == strings.Title(structName) {
  			titledType = "*" + titledType // add `pointer`, otherwise compiler will complain
  		}
  
  		// use strings.Replace instead of simple assignment because the fieldType
  		// might be an array
  		fieldType = strings.Replace(fieldType, basicType, titledType, 1)
  	}
  	fieldType = convertToGoType(fieldType, prop.Items.Type)
  
  	fd := fieldDef{
  		Name:      formatFieldName(prop.Name),
  		fieldType: fieldType,
  		IsOmitted: !prop.Required,
  	}
  
  	fd.buildValidators(prop)
  
  	if prop.IsEnum() {
  		fd.Enum = newEnum(structName, prop, pkg, false)
  		fd.fieldType = fd.Enum.Name
  	}
  
  	return fd
  }
docs: // newFieldDef creates new struct field from raml property.