You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ba...@apache.org on 2023/03/07 08:05:23 UTC

[apisix-dashboard] branch master updated: fix: remove route name length limit (#2759)

This is an automated email from the ASF dual-hosted git repository.

baoyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new a393073a fix: remove route name length limit (#2759)
a393073a is described below

commit a393073a1923e8b36ff54139be0b57d34ab087cc
Author: Baoyuan <ba...@gmail.com>
AuthorDate: Tue Mar 7 16:05:17 2023 +0800

    fix: remove route name length limit (#2759)
---
 api/internal/core/entity/entity.go |  6 +++---
 api/test/e2e/route/route_test.go   | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/api/internal/core/entity/entity.go b/api/internal/core/entity/entity.go
index f8fcc1c6..b8de0a9e 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 d73cf949..099c2792 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,