You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/12/23 11:17:33 UTC

[apisix] branch master updated: feat: add script_id field used by dashboard (#3096)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a661b94  feat: add script_id field used by dashboard (#3096)
a661b94 is described below

commit a661b940b0ae2fe45a8a8612e41d7bcda136a0c4
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Wed Dec 23 19:17:26 2020 +0800

    feat: add script_id field used by dashboard (#3096)
    
    Used as a reference to script metadata.
---
 apisix/schema_def.lua        |  2 ++
 t/config-center-yaml/route.t | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index bc07765..f4af8d0 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -459,7 +459,9 @@ _M.route = {
             pattern = [[^function]],
         },
 
+        -- The 'script' fields below are used by dashboard for plugin orchestration
         script = {type = "string", minLength = 10, maxLength = 102400},
+        script_id = id_schema,
 
         plugins = plugins_schema,
         upstream = upstream_schema,
diff --git a/t/config-center-yaml/route.t b/t/config-center-yaml/route.t
index 791defb..9c5e30c 100644
--- a/t/config-center-yaml/route.t
+++ b/t/config-center-yaml/route.t
@@ -231,3 +231,27 @@ routes:
 --- request
 GET /hello
 --- error_code: 404
+
+
+
+=== TEST 9: script with id
+--- yaml_config
+apisix:
+    node_listen: 1984
+    config_center: yaml
+    enable_admin: false
+--- apisix_yaml
+routes:
+  -
+    id: 1
+    uri: /hello
+    script: "local ngx = ngx"
+    script_id: "1"
+    upstream:
+        nodes:
+            "127.0.0.1:1980": 1
+        type: roundrobin
+#END
+--- request
+GET /hello
+--- error_code: 200