func main() { flag.Parse() if *mainApiFile == "" { *mainApiFile = *apiPackage + "/main.go" } if *apiPackage == "" { flag.PrintDefaults() return } params := generator.Params{ ApiPackage: *apiPackage, MainApiFile: *mainApiFile, OutputFormat: *outputFormat, OutputSpec: *outputSpec, ControllerClass: *controllerClass, Ignore: *ignore, } err := generator.Run(params) if err != nil { log.Fatal(err.Error()) } }
func (s *Swagger) Generate() error { if s.ExternalAPIPackage == "" { return errors.New("You must specify an api package for the swagger doc to be generated") } params := generator.Params{ ApiPackage: "github.com/solher/zest/resources," + s.ExternalAPIPackage + "/resources", MainApiFile: s.ExternalAPIPackage + "/main.go", OutputFormat: "swagger", ControllerClass: "(Ctrl)$", OutputSpec: "swagger/resources", } err := generator.Run(params) if err != nil { return err } return nil }