diff --git a/api/internal/core/entity/entity.go b/api/internal/core/entity/entity.go index f8fcc1c604..b8de0a9e0c 100644 --- a/api/internal/core/entity/entity.go +++ b/api/internal/core/entity/entity.go @@ -65,8 +65,8 @@ type Route struct { BaseInfo URI string `json:"uri,omitempty"` Uris []string `json:"uris,omitempty"` - Name string `json:"name" validate:"max=50"` - Desc string `json:"desc,omitempty" validate:"max=256"` + Name string `json:"name"` + Desc string `json:"desc,omitempty"` Priority int `json:"priority,omitempty"` Methods []string `json:"methods,omitempty"` Host string `json:"host,omitempty"` @@ -280,7 +280,7 @@ type ServerInfo struct { // swagger:model GlobalPlugins type PluginConfig struct { BaseInfo - Desc string `json:"desc,omitempty" validate:"max=256"` + Desc string `json:"desc,omitempty"` Plugins map[string]interface{} `json:"plugins"` Labels map[string]string `json:"labels,omitempty"` } diff --git a/api/test/e2e/route/route_test.go b/api/test/e2e/route/route_test.go index d73cf949ed..099c27925e 100644 --- a/api/test/e2e/route/route_test.go +++ b/api/test/e2e/route/route_test.go @@ -63,6 +63,23 @@ var _ = Describe("Route", func() { Headers: map[string]string{"Authorization": base.GetToken()}, ExpectStatus: http.StatusOK, }), + Entry("create long name route3 success", base.HttpTestCase{ + Object: base.ManagerApiExpect(), + Method: http.MethodPut, + Path: "/apisix/admin/routes/r3", + Body: `{ + "name": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "uri": "/hello_", + "upstream": { + "nodes": { + "` + base.UpstreamIp + `:1980": 1 + }, + "type": "roundrobin" + } + }`, + Headers: map[string]string{"Authorization": base.GetToken()}, + ExpectStatus: http.StatusOK, + }), Entry("create route failed, name existed", base.HttpTestCase{ Object: base.ManagerApiExpect(), Method: http.MethodPost, @@ -146,6 +163,13 @@ var _ = Describe("Route", func() { Headers: map[string]string{"Authorization": base.GetToken()}, ExpectStatus: http.StatusOK, }), + Entry("delete route3", base.HttpTestCase{ + Object: base.ManagerApiExpect(), + Method: http.MethodDelete, + Path: "/apisix/admin/routes/r3", + Headers: map[string]string{"Authorization": base.GetToken()}, + ExpectStatus: http.StatusOK, + }), Entry("hit route1 that just deleted", base.HttpTestCase{ Object: base.APISIXExpect(), Method: http.MethodGet,