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()
  		}
  	}()
  
  	s := APISchema(g.API)
  	js, err := s.JSON()
  	if err != nil {
  		return
  	}
  
  	g.OutDir = filepath.Join(g.OutDir, "schema")
  	os.RemoveAll(g.OutDir)
  	os.MkdirAll(g.OutDir, 0755)
  	g.genfiles = append(g.genfiles, g.OutDir)
  	schemaFile := filepath.Join(g.OutDir, "schema.json")
  	if err = ioutil.WriteFile(schemaFile, js, 0644); err != nil {
  		return
  	}
  	g.genfiles = append(g.genfiles, schemaFile)
  
  	return g.genfiles, nil
  }
docs: // Generate produces the skeleton main.