code: func (g *Generator) Generate() (_ []string, err error) {
  	if g.API == nil {
  		return nil, fmt.Errorf("missing API definition, make sure design is properly initialized")
  	}
  
  	go utils.Catch(nil, func() { g.Cleanup() })
  
  	defer func() {
  		if err != nil {
  			g.Cleanup()
  		}
  	}()
  
  	codegen.Reserved[g.Target] = true
  
  	os.RemoveAll(g.OutDir)
  
  	if err := os.MkdirAll(g.OutDir, 0755); err != nil {
  		return nil, err
  	}
  	g.genfiles = []string{g.OutDir}
  	if err := g.generateContexts(); err != nil {
  		return nil, err
  	}
  	if err := g.generateControllers(); err != nil {
  		return nil, err
  	}
  	if err := g.generateSecurity(); err != nil {
  		return nil, err
  	}
  	if err := g.generateHrefs(); err != nil {
  		return nil, err
  	}
  	if err := g.generateMediaTypes(); err != nil {
  		return nil, err
  	}
  	if err := g.generateUserTypes(); err != nil {
  		return nil, err
  	}
  	if !g.NoTest {
  		if err := g.generateResourceTest(); err != nil {
  			return nil, err
  		}
  	}
  
  	return g.genfiles, nil
  }
docs: // Generate the application code, implement codegen.Generator.