code: func (g *Generator) generateUserTypes() (err error) {
  	var (
  		utFile string
  		utWr   *UserTypesWriter
  	)
  	{
  		utFile = filepath.Join(g.OutDir, "user_types.go")
  		utWr, err = NewUserTypesWriter(utFile)
  		if err != nil {
  			return
  		}
  	}
  	defer func() {
  		utWr.Close()
  		if err == nil {
  			err = utWr.FormatCode()
  		}
  	}()
  	title := fmt.Sprintf("%s: Application User Types", g.API.Context())
  	imports := []*codegen.ImportSpec{
  		codegen.SimpleImport("fmt"),
  		codegen.SimpleImport("mime/multipart"),
  		codegen.SimpleImport("time"),
  		codegen.SimpleImport("unicode/utf8"),
  		codegen.SimpleImport("github.com/goadesign/goa"),
  		codegen.NewImport("uuid", "github.com/gofrs/uuid"),
  	}
  	for _, v := range g.API.Types {
  		imports = codegen.AttributeImports(v.AttributeDefinition, imports, nil)
  	}
  	if err = utWr.WriteHeader(title, g.Target, imports); err != nil {
  		return err
  	}
  	g.genfiles = append(g.genfiles, utFile)
  	err = g.API.IterateUserTypes(func(t *design.UserTypeDefinition) error {
  		return utWr.Execute(t)
  	})
  	return
  }
docs: // generateUserTypes iterates through the user types and generates the data structures and
  // marshaling code.