You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/11/16 10:00:10 UTC

[apisix] branch master updated: fix(wasm): the conf can't be empty (#5514)

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

spacewander 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 2c12b36  fix(wasm): the conf can't be empty (#5514)
2c12b36 is described below

commit 2c12b3695302f580a1498333aaafb68da26a3096
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Tue Nov 16 18:00:03 2021 +0800

    fix(wasm): the conf can't be empty (#5514)
---
 apisix/wasm.lua        | 3 ++-
 docs/en/latest/wasm.md | 2 +-
 t/wasm/route.t         | 4 ++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/apisix/wasm.lua b/apisix/wasm.lua
index c99731a..9e3e929 100644
--- a/apisix/wasm.lua
+++ b/apisix/wasm.lua
@@ -22,7 +22,8 @@ local schema = {
     type = "object",
     properties = {
         conf = {
-            type = "string"
+            type = "string",
+            minLength = 1,
         },
     },
     required = {"conf"}
diff --git a/docs/en/latest/wasm.md b/docs/en/latest/wasm.md
index 5f13d7e..9606bd8 100644
--- a/docs/en/latest/wasm.md
+++ b/docs/en/latest/wasm.md
@@ -93,4 +93,4 @@ Attributes below can be configured in the plugin:
 
 | Name           | Type                 | Requirement | Default        | Valid                                                                      | Description                                                                                                                                         |
 | --------------------------------------| ------------| -------------- | -------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
-|  conf         | string | required |   |          | the plugin ctx configuration which can be fetched via Proxy WASM SDK |
+|  conf         | string | required |   |  != ""        | the plugin ctx configuration which can be fetched via Proxy WASM SDK |
diff --git a/t/wasm/route.t b/t/wasm/route.t
index 69f43d3..cb34801 100644
--- a/t/wasm/route.t
+++ b/t/wasm/route.t
@@ -65,6 +65,9 @@ __DATA__
                 {input = {
                     conf = {}
                 }},
+                {input = {
+                    conf = ""
+                }},
             }) do
                 local code, body = t('/apisix/admin/routes/1',
                     ngx.HTTP_PUT,
@@ -87,6 +90,7 @@ __DATA__
 --- response_body
 failed to check the configuration of plugin wasm_log err: property "conf" is required
 failed to check the configuration of plugin wasm_log err: property "conf" validation failed: wrong type: expected string, got table
+failed to check the configuration of plugin wasm_log err: property "conf" validation failed: string too short, expected at least 1, got 0