func configureAPI(api *operations.TaskTrackerAPI) http.Handler { // configure the api here api.ServeError = errors.ServeError api.JSONConsumer = runtime.JSONConsumer() api.MulitpartformConsumer = runtime.DiscardConsumer api.JSONProducer = runtime.JSONProducer() api.APIKeyAuth = func(token string) (interface{}, error) { return nil, errors.NotImplemented("api key auth (api_key) token from query has not yet been implemented") } api.TokenHeaderAuth = func(token string) (interface{}, error) { return nil, errors.NotImplemented("api key auth (token_header) X-Token from header has not yet been implemented") } api.TasksAddCommentToTaskHandler = tasks.AddCommentToTaskHandlerFunc(func(params tasks.AddCommentToTaskParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation tasks.AddCommentToTask has not yet been implemented") }) api.TasksCreateTaskHandler = tasks.CreateTaskHandlerFunc(func(params tasks.CreateTaskParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation tasks.CreateTask has not yet been implemented") }) api.TasksDeleteTaskHandler = tasks.DeleteTaskHandlerFunc(func(params tasks.DeleteTaskParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation tasks.DeleteTask has not yet been implemented") }) api.TasksGetTaskCommentsHandler = tasks.GetTaskCommentsHandlerFunc(func(params tasks.GetTaskCommentsParams) middleware.Responder { return middleware.NotImplemented("operation tasks.GetTaskComments has not yet been implemented") }) api.TasksGetTaskDetailsHandler = tasks.GetTaskDetailsHandlerFunc(func(params tasks.GetTaskDetailsParams) middleware.Responder { return middleware.NotImplemented("operation tasks.GetTaskDetails has not yet been implemented") }) api.TasksListTasksHandler = tasks.ListTasksHandlerFunc(func(params tasks.ListTasksParams) middleware.Responder { return middleware.NotImplemented("operation tasks.ListTasks has not yet been implemented") }) api.TasksUpdateTaskHandler = tasks.UpdateTaskHandlerFunc(func(params tasks.UpdateTaskParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation tasks.UpdateTask has not yet been implemented") }) api.TasksUploadTaskFileHandler = tasks.UploadTaskFileHandlerFunc(func(params tasks.UploadTaskFileParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation tasks.UploadTaskFile has not yet been implemented") }) api.ServerShutdown = func() {} return setupGlobalMiddleware(api.Serve(setupMiddlewares)) }
func TestUntypedFileUpload(t *testing.T) { binder := paramsForFileUpload() body := bytes.NewBuffer(nil) writer := multipart.NewWriter(body) part, err := writer.CreateFormFile("file", "plain-jane.txt") assert.NoError(t, err) part.Write([]byte("the file contents")) writer.WriteField("name", "the-name") assert.NoError(t, writer.Close()) urlStr := "http://localhost:8002/hello" req, _ := http.NewRequest("POST", urlStr, body) req.Header.Set("Content-Type", writer.FormDataContentType()) data := make(map[string]interface{}) assert.NoError(t, binder.Bind(req, nil, runtime.JSONConsumer(), &data)) assert.Equal(t, "the-name", data["name"]) assert.NotNil(t, data["file"]) assert.IsType(t, runtime.File{}, data["file"]) file := data["file"].(runtime.File) assert.NotNil(t, file.Header) assert.Equal(t, "plain-jane.txt", file.Header.Filename) bb, err := ioutil.ReadAll(file.Data) assert.NoError(t, err) assert.Equal(t, []byte("the file contents"), bb) req, _ = http.NewRequest("POST", urlStr, body) req.Header.Set("Content-Type", "application/json") data = make(map[string]interface{}) assert.Error(t, binder.Bind(req, nil, runtime.JSONConsumer(), &data)) req, _ = http.NewRequest("POST", urlStr, body) req.Header.Set("Content-Type", "application(") data = make(map[string]interface{}) assert.Error(t, binder.Bind(req, nil, runtime.JSONConsumer(), &data)) body = bytes.NewBuffer(nil) writer = multipart.NewWriter(body) part, err = writer.CreateFormFile("bad-name", "plain-jane.txt") assert.NoError(t, err) part.Write([]byte("the file contents")) writer.WriteField("name", "the-name") assert.NoError(t, writer.Close()) req, _ = http.NewRequest("POST", urlStr, body) req.Header.Set("Content-Type", writer.FormDataContentType()) data = make(map[string]interface{}) assert.Error(t, binder.Bind(req, nil, runtime.JSONConsumer(), &data)) req, _ = http.NewRequest("POST", urlStr, body) req.Header.Set("Content-Type", writer.FormDataContentType()) req.MultipartReader() data = make(map[string]interface{}) assert.Error(t, binder.Bind(req, nil, runtime.JSONConsumer(), &data)) }
// New creates a new default runtime for a swagger api runtime.Client func New(host, basePath string, schemes []string) *Runtime { var rt Runtime rt.DefaultMediaType = runtime.JSONMime // TODO: actually infer this stuff from the spec rt.Consumers = map[string]runtime.Consumer{ runtime.JSONMime: runtime.JSONConsumer(), runtime.XMLMime: runtime.XMLConsumer(), runtime.TextMime: runtime.TextConsumer(), } rt.Producers = map[string]runtime.Producer{ runtime.JSONMime: runtime.JSONProducer(), runtime.XMLMime: runtime.XMLProducer(), runtime.TextMime: runtime.TextProducer(), } rt.Transport = http.DefaultTransport rt.Jar = nil rt.Host = host rt.BasePath = basePath rt.Context = context.Background() rt.clientOnce = new(sync.Once) if !strings.HasPrefix(rt.BasePath, "/") { rt.BasePath = "/" + rt.BasePath } rt.Debug = os.Getenv("DEBUG") == "1" if len(schemes) > 0 { rt.schemes = schemes } return &rt }
func configureAPI(api *operations.TodoListAPI) http.Handler { // configure the api here api.ServeError = errors.ServeError api.JSONConsumer = runtime.JSONConsumer() api.JSONProducer = runtime.JSONProducer() api.KeyAuth = func(token string) (interface{}, error) { return nil, errors.NotImplemented("api key auth (key) x-petstore-token from header has not yet been implemented") } api.TodosAddOneHandler = todos.AddOneHandlerFunc(func(params todos.AddOneParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation todos.AddOne has not yet been implemented") }) api.TodosDestroyOneHandler = todos.DestroyOneHandlerFunc(func(params todos.DestroyOneParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation todos.DestroyOne has not yet been implemented") }) api.TodosFindHandler = todos.FindHandlerFunc(func(params todos.FindParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation todos.Find has not yet been implemented") }) api.TodosUpdateOneHandler = todos.UpdateOneHandlerFunc(func(params todos.UpdateOneParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation todos.UpdateOne has not yet been implemented") }) api.ServerShutdown = func() {} return setupGlobalMiddleware(api.Serve(setupMiddlewares)) }
// WithJSONDefaults loads the json defaults for this api func (d *API) WithJSONDefaults() *API { d.DefaultConsumes = runtime.JSONMime d.DefaultProduces = runtime.JSONMime d.consumers[runtime.JSONMime] = runtime.JSONConsumer() d.producers[runtime.JSONMime] = runtime.JSONProducer() return d }
func TestBindRequest_BodyValidation(t *testing.T) { spec, api := petstore.NewAPI(t) ctx := NewContext(spec, api, nil) api.DefaultConsumes = runtime.JSONMime ctx.router = DefaultRouter(spec, ctx.api) req, err := http.NewRequest("GET", "/pets", new(eofReader)) if assert.NoError(t, err) { req.Header.Set("Content-Type", runtime.JSONMime) ri, ok := ctx.RouteInfo(req) if assert.True(t, ok) { err := ctx.BindValidRequest(req, ri, rbn(func(r *http.Request, rr *MatchedRoute) error { defer r.Body.Close() var data interface{} err := runtime.JSONConsumer().Consume(r.Body, &data) _ = data return err })) assert.Error(t, err) assert.Equal(t, io.EOF, err) } } }
func configureAPI(api *operations.TodoListAPI) http.Handler { // configure the api here api.ServeError = errors.ServeError api.JSONConsumer = runtime.JSONConsumer() api.JSONProducer = runtime.JSONProducer() api.TodosAddOneHandler = todos.AddOneHandlerFunc(func(params todos.AddOneParams) middleware.Responder { return middleware.NotImplemented("operation todos.AddOne has not yet been implemented") }) api.TodosDestroyOneHandler = todos.DestroyOneHandlerFunc(func(params todos.DestroyOneParams) middleware.Responder { return middleware.NotImplemented("operation todos.DestroyOne has not yet been implemented") }) api.TodosFindTodosHandler = todos.FindTodosHandlerFunc(func(params todos.FindTodosParams) middleware.Responder { return middleware.NotImplemented("operation todos.FindTodos has not yet been implemented") }) api.TodosUpdateOneHandler = todos.UpdateOneHandlerFunc(func(params todos.UpdateOneParams) middleware.Responder { return middleware.NotImplemented("operation todos.UpdateOne has not yet been implemented") }) api.ServerShutdown = func() {} return setupGlobalMiddleware(api.Serve(setupMiddlewares)) }
func configureAPI(api *operations.AttendListAPI) http.Handler { // configure the api here api.ServeError = errors.ServeError api.JSONConsumer = httpkit.JSONConsumer() api.JSONProducer = httpkit.JSONProducer() api.EventsDeleteEventByIDHandler = events.DeleteEventByIDHandlerFunc(func(params events.DeleteEventByIDParams) middleware.Responder { return middleware.NotImplemented("operation events.DeleteEventByID has not yet been implemented") }) api.EventsGetEventByIDHandler = events.GetEventByIDHandlerFunc(func(params events.GetEventByIDParams) middleware.Responder { return middleware.NotImplemented("operation events.GetEventByID has not yet been implemented") }) api.EventsGetEventsHandler = events.GetEventsHandlerFunc(func() middleware.Responder { return middleware.NotImplemented("operation events.GetEvents has not yet been implemented") }) api.EventsPostEventHandler = events.PostEventHandlerFunc(func(params events.PostEventParams) middleware.Responder { return middleware.NotImplemented("operation events.PostEvent has not yet been implemented") }) api.EventsPutEventByIDHandler = events.PutEventByIDHandlerFunc(func(params events.PutEventByIDParams) middleware.Responder { return middleware.NotImplemented("operation events.PutEventByID has not yet been implemented") }) api.ServerShutdown = func() {} return setupGlobalMiddleware(api.Serve(setupMiddlewares)) }
func TestUntypedFormPost(t *testing.T) { params := parametersForFormUpload() binder := newUntypedRequestBinder(params, nil, strfmt.Default) urlStr := "http://localhost:8002/hello" req, _ := http.NewRequest("POST", urlStr, bytes.NewBufferString(`name=the-name&age=32`)) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") data := make(map[string]interface{}) assert.NoError(t, binder.Bind(req, nil, runtime.JSONConsumer(), &data)) assert.Equal(t, "the-name", data["name"]) assert.EqualValues(t, 32, data["age"]) req, _ = http.NewRequest("POST", urlStr, bytes.NewBufferString(`name=%3&age=32`)) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") data = make(map[string]interface{}) assert.Error(t, binder.Bind(req, nil, runtime.JSONConsumer(), &data)) }
func TestUntypedBindingTypesForValid(t *testing.T) { op2 := parametersForAllTypes("") binder := newUntypedRequestBinder(op2, nil, strfmt.Default) confirmed := true name := "thomas" friend := map[string]interface{}{"name": "toby", "age": json.Number("32")} id, age, score, factor := int64(7575), int32(348), float32(5.309), float64(37.403) requestID := 19394858 tags := []string{"one", "two", "three"} dt1 := time.Date(2014, 8, 9, 0, 0, 0, 0, time.UTC) planned := strfmt.Date(dt1) dt2 := time.Date(2014, 10, 12, 8, 5, 5, 0, time.UTC) delivered := strfmt.DateTime(dt2) picture := base64.URLEncoding.EncodeToString([]byte("hello")) uri, _ := url.Parse("http://localhost:8002/hello/7575") qs := uri.Query() qs.Add("name", name) qs.Add("confirmed", "true") qs.Add("age", "348") qs.Add("score", "5.309") qs.Add("factor", "37.403") qs.Add("tags", strings.Join(tags, ",")) qs.Add("planned", planned.String()) qs.Add("delivered", delivered.String()) qs.Add("picture", picture) req, _ := http.NewRequest("POST", uri.String()+"?"+qs.Encode(), bytes.NewBuffer([]byte(`{"name":"toby","age":32}`))) req.Header.Set("Content-Type", "application/json") req.Header.Set("X-Request-Id", "19394858") data := make(map[string]interface{}) err := binder.Bind(req, RouteParams([]RouteParam{{"id", "7575"}}), runtime.JSONConsumer(), &data) assert.NoError(t, err) assert.Equal(t, id, data["id"]) assert.Equal(t, name, data["name"]) assert.Equal(t, friend, data["friend"]) assert.EqualValues(t, requestID, data["X-Request-Id"]) assert.Equal(t, tags, data["tags"]) assert.Equal(t, planned, data["planned"]) assert.Equal(t, delivered, data["delivered"]) assert.Equal(t, confirmed, data["confirmed"]) assert.Equal(t, age, data["age"]) assert.Equal(t, factor, data["factor"]) assert.Equal(t, score, data["score"]) pb, _ := base64.URLEncoding.DecodeString(picture) assert.EqualValues(t, pb, data["picture"].(strfmt.Base64)) }
func TestContentType_Issue264(t *testing.T) { swspec, err := loads.Spec("../fixtures/bugs/264/swagger.yml") if assert.NoError(t, err) { api := untyped.NewAPI(swspec) api.RegisterConsumer("application/json", runtime.JSONConsumer()) api.RegisterProducer("application/json", runtime.JSONProducer()) api.RegisterOperation("delete", "/key/{id}", new(stubOperationHandler)) handler := Serve(swspec, api) request, _ := http.NewRequest("DELETE", "/key/1", nil) recorder := httptest.NewRecorder() handler.ServeHTTP(recorder, request) assert.Equal(t, 200, recorder.Code) } }
func configureAPI(api *operations.TodoListAPI) http.Handler { // configure the api here api.ServeError = errors.ServeError api.JSONConsumer = httpkit.JSONConsumer() api.JSONProducer = httpkit.JSONProducer() api.TodosAddOneHandler = todos.AddOneHandlerFunc(func(params todos.AddOneParams) middleware.Responder { if err := addItem(params.Body); err != nil { return todos.NewAddOneDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String(err.Error())}) } return todos.NewAddOneCreated().WithPayload(params.Body) }) api.TodosDestroyOneHandler = todos.DestroyOneHandlerFunc(func(params todos.DestroyOneParams) middleware.Responder { if err := deleteItem(params.ID); err != nil { return todos.NewDestroyOneDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String(err.Error())}) } return todos.NewDestroyOneNoContent() }) api.TodosFindTodosHandler = todos.FindTodosHandlerFunc(func(params todos.FindTodosParams) middleware.Responder { mergedParams := todos.NewFindTodosParams() mergedParams.Since = swag.Int64(0) if params.Since != nil { mergedParams.Since = params.Since } if params.Limit != nil { mergedParams.Limit = params.Limit } return todos.NewFindTodosOK().WithPayload(allItems(*mergedParams.Since, *mergedParams.Limit)) }) api.TodosUpdateOneHandler = todos.UpdateOneHandlerFunc(func(params todos.UpdateOneParams) middleware.Responder { if err := updateItem(params.ID, params.Body); err != nil { return todos.NewUpdateOneDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String(err.Error())}) } return todos.NewUpdateOneOK().WithPayload(params.Body) }) api.ServerShutdown = func() {} return setupGlobalMiddleware(api.Serve(setupMiddlewares)) }
// NewAPI creates the default untyped API func NewAPI(spec *loads.Document) *API { var an *analysis.Spec if spec != nil && spec.Spec() != nil { an = analysis.New(spec.Spec()) } return &API{ spec: spec, analyzer: an, DefaultProduces: runtime.JSONMime, DefaultConsumes: runtime.JSONMime, consumers: map[string]runtime.Consumer{ runtime.JSONMime: runtime.JSONConsumer(), }, producers: map[string]runtime.Producer{ runtime.JSONMime: runtime.JSONProducer(), }, authenticators: make(map[string]runtime.Authenticator), operations: make(map[string]map[string]runtime.OperationHandler), ServeError: errors.ServeError, Models: make(map[string]func() interface{}), formats: strfmt.NewFormats(), } }
// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure func (m *ProductRatePlan) UnmarshalJSON(raw []byte) error { var data struct { AggregatingComponents []*AggregatingComponent `json:"aggregatingComponents,omitempty"` ChangedBy string `json:"changedBy,omitempty"` CreateZeroValuedInvoices bool `json:"createZeroValuedInvoices"` Created strfmt.DateTime `json:"created,omitempty"` CrmID string `json:"crmID,omitempty"` Currency *string `json:"currency"` Duration int32 `json:"duration,omitempty"` DurationPeriod *string `json:"durationPeriod"` FailedPaymentBehaviour *string `json:"failedPaymentBehaviour"` FixedTermDefinitions []*MutableBillingEntity `json:"fixedTermDefinitions,omitempty"` ID string `json:"id,omitempty"` InvoiceIssueType string `json:"invoiceIssueType,omitempty"` IssueDuration int32 `json:"issueDuration,omitempty"` IssuePeriod string `json:"issuePeriod,omitempty"` Metadata DynamicMetadata `json:"metadata,omitempty"` MigrationBehaviour *string `json:"migrationBehaviour"` Name *string `json:"name"` PaymentTerms int64 `json:"paymentTerms,omitempty"` PricingComponents json.RawMessage `json:"pricingComponents"` ProRataMode *string `json:"proRataMode"` Product *Product `json:"product,omitempty"` ProductID *string `json:"productID"` ProductType string `json:"productType,omitempty"` PublicName string `json:"publicName,omitempty"` Status string `json:"status,omitempty"` TaxStatus *string `json:"taxStatus"` Taxation []*MutableBillingEntity `json:"taxation,omitempty"` Trial int32 `json:"trial,omitempty"` TrialPeriod string `json:"trialPeriod,omitempty"` Updated strfmt.DateTime `json:"updated,omitempty"` ValidFrom strfmt.DateTime `json:"validFrom,omitempty"` ValidTill strfmt.DateTime `json:"validTill,omitempty"` } buf := bytes.NewBuffer(raw) dec := json.NewDecoder(buf) dec.UseNumber() if err := dec.Decode(&data); err != nil { return err } var pricingComponents []PricingComponent buf = bytes.NewBuffer(raw) dec = json.NewDecoder(buf) dec.UseNumber() untypedObj := make(map[string]interface{}) if err := dec.Decode(&untypedObj); err != nil { return err } if untypedPricingComponents, ok := untypedObj["pricingComponents"]; ok { if slcPricingComponents, ok := untypedPricingComponents.([]interface{}); ok { for _, slcEl := range slcPricingComponents { slcJSON, _ := json.Marshal(slcEl) slcObj, err := UnmarshalPricingComponent(bytes.NewBuffer(slcJSON), runtime.JSONConsumer()) if err != nil { return err } pricingComponents = append(pricingComponents, slcObj) } } } var result ProductRatePlan result.AggregatingComponents = data.AggregatingComponents result.ChangedBy = data.ChangedBy result.CreateZeroValuedInvoices = data.CreateZeroValuedInvoices result.Created = data.Created result.CrmID = data.CrmID result.Currency = data.Currency result.Duration = data.Duration result.DurationPeriod = data.DurationPeriod result.FailedPaymentBehaviour = data.FailedPaymentBehaviour result.FixedTermDefinitions = data.FixedTermDefinitions result.ID = data.ID result.InvoiceIssueType = data.InvoiceIssueType result.IssueDuration = data.IssueDuration result.IssuePeriod = data.IssuePeriod result.Metadata = data.Metadata result.MigrationBehaviour = data.MigrationBehaviour result.Name = data.Name result.PaymentTerms = data.PaymentTerms result.PricingComponents = pricingComponents result.ProRataMode = data.ProRataMode result.Product = data.Product result.ProductID = data.ProductID result.ProductType = data.ProductType result.PublicName = data.PublicName result.Status = data.Status result.TaxStatus = data.TaxStatus result.Taxation = data.Taxation result.Trial = data.Trial result.TrialPeriod = data.TrialPeriod result.Updated = data.Updated result.ValidFrom = data.ValidFrom result.ValidTill = data.ValidTill *m = result return nil }
// RegisterConsumer registers a consumer for a media type. func (d *API) RegisterConsumer(mediaType string, handler runtime.Consumer) { if d.consumers == nil { d.consumers = map[string]runtime.Consumer{runtime.JSONMime: runtime.JSONConsumer()} } d.consumers[strings.ToLower(mediaType)] = handler }
func configureAPI(api *operations.PetstoreAPI) http.Handler { // configure the api here api.ServeError = errors.ServeError api.XMLConsumer = runtime.XMLConsumer() api.UrlformConsumer = runtime.DiscardConsumer api.JSONConsumer = runtime.JSONConsumer() api.XMLProducer = runtime.XMLProducer() api.JSONProducer = runtime.JSONProducer() api.APIKeyAuth = func(token string) (interface{}, error) { return nil, errors.NotImplemented("api key auth (api_key) api_key from header has not yet been implemented") } api.PetstoreAuthAuth = func(token string, scopes []string) (interface{}, error) { return nil, errors.NotImplemented("oauth2 bearer auth (petstore_auth) has not yet been implemented") } api.PetAddPetHandler = pet.AddPetHandlerFunc(func(params pet.AddPetParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation pet.AddPet has not yet been implemented") }) api.UserCreateUserHandler = user.CreateUserHandlerFunc(func(params user.CreateUserParams) middleware.Responder { return middleware.NotImplemented("operation user.CreateUser has not yet been implemented") }) api.UserCreateUsersWithArrayInputHandler = user.CreateUsersWithArrayInputHandlerFunc(func(params user.CreateUsersWithArrayInputParams) middleware.Responder { return middleware.NotImplemented("operation user.CreateUsersWithArrayInput has not yet been implemented") }) api.UserCreateUsersWithListInputHandler = user.CreateUsersWithListInputHandlerFunc(func(params user.CreateUsersWithListInputParams) middleware.Responder { return middleware.NotImplemented("operation user.CreateUsersWithListInput has not yet been implemented") }) api.StoreDeleteOrderHandler = store.DeleteOrderHandlerFunc(func(params store.DeleteOrderParams) middleware.Responder { return middleware.NotImplemented("operation store.DeleteOrder has not yet been implemented") }) api.PetDeletePetHandler = pet.DeletePetHandlerFunc(func(params pet.DeletePetParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation pet.DeletePet has not yet been implemented") }) api.UserDeleteUserHandler = user.DeleteUserHandlerFunc(func(params user.DeleteUserParams) middleware.Responder { return middleware.NotImplemented("operation user.DeleteUser has not yet been implemented") }) api.PetFindPetsByStatusHandler = pet.FindPetsByStatusHandlerFunc(func(params pet.FindPetsByStatusParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation pet.FindPetsByStatus has not yet been implemented") }) api.PetFindPetsByTagsHandler = pet.FindPetsByTagsHandlerFunc(func(params pet.FindPetsByTagsParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation pet.FindPetsByTags has not yet been implemented") }) api.StoreGetOrderByIDHandler = store.GetOrderByIDHandlerFunc(func(params store.GetOrderByIDParams) middleware.Responder { return middleware.NotImplemented("operation store.GetOrderByID has not yet been implemented") }) api.PetGetPetByIDHandler = pet.GetPetByIDHandlerFunc(func(params pet.GetPetByIDParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation pet.GetPetByID has not yet been implemented") }) api.UserGetUserByNameHandler = user.GetUserByNameHandlerFunc(func(params user.GetUserByNameParams) middleware.Responder { return middleware.NotImplemented("operation user.GetUserByName has not yet been implemented") }) api.UserLoginUserHandler = user.LoginUserHandlerFunc(func(params user.LoginUserParams) middleware.Responder { return middleware.NotImplemented("operation user.LoginUser has not yet been implemented") }) api.UserLogoutUserHandler = user.LogoutUserHandlerFunc(func() middleware.Responder { return middleware.NotImplemented("operation user.LogoutUser has not yet been implemented") }) api.StorePlaceOrderHandler = store.PlaceOrderHandlerFunc(func(params store.PlaceOrderParams) middleware.Responder { return middleware.NotImplemented("operation store.PlaceOrder has not yet been implemented") }) api.PetUpdatePetHandler = pet.UpdatePetHandlerFunc(func(params pet.UpdatePetParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation pet.UpdatePet has not yet been implemented") }) api.PetUpdatePetWithFormHandler = pet.UpdatePetWithFormHandlerFunc(func(params pet.UpdatePetWithFormParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation pet.UpdatePetWithForm has not yet been implemented") }) api.UserUpdateUserHandler = user.UpdateUserHandlerFunc(func(params user.UpdateUserParams) middleware.Responder { return middleware.NotImplemented("operation user.UpdateUser has not yet been implemented") }) api.ServerShutdown = func() {} return setupGlobalMiddleware(api.Serve(setupMiddlewares)) }