// Execute runs this command func (s *Server) Execute(args []string) error { opts := generator.GenOpts{ Spec: string(s.Spec), Target: string(s.Target), APIPackage: s.APIPackage, ModelPackage: s.ModelPackage, ServerPackage: s.ServerPackage, ClientPackage: s.ClientPackage, Principal: s.Principal, } if !s.SkipModels && (len(s.Models) > 0 || len(s.Operations) == 0) { if err := generator.GenerateDefinition(s.Models, true, true, opts); err != nil { return err } } if !s.SkipOperations && (len(s.Operations) > 0 || len(s.Models) == 0) { if err := generator.GenerateServerOperation(s.Operations, s.Tags, true, true, opts); err != nil { return err } } if !s.SkipSupport { if err := generator.GenerateSupport(s.Name, s.Models, s.Operations, opts); err != nil { return err } } return nil }
// Execute generates a model file func (o *Operation) Execute(args []string) error { if o.DumpData && len(o.Name) > 1 { return errors.New("only 1 operation at a time is supported for dumping data") } return generator.GenerateServerOperation( o.Name, o.Tags, !o.NoHandler, !o.NoStruct, generator.GenOpts{ Spec: string(o.Spec), Target: string(o.Target), APIPackage: o.APIPackage, ModelPackage: o.ModelPackage, ServerPackage: o.ServerPackage, ClientPackage: o.ClientPackage, Principal: o.Principal, DumpData: o.DumpData, }) }