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/09/18 03:58:29 UTC
[apisix] branch master updated: fix(gzip): schema typo (#5086)
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 cc644a8 fix(gzip): schema typo (#5086)
cc644a8 is described below
commit cc644a83eb263ce6a5998ec465d0c3dd99f26a22
Author: bzp2010 <bz...@apache.org>
AuthorDate: Fri Sep 17 22:58:24 2021 -0500
fix(gzip): schema typo (#5086)
---
apisix/plugins/gzip.lua | 2 +-
t/plugin/gzip.t | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/apisix/plugins/gzip.lua b/apisix/plugins/gzip.lua
index ac7128e..0c70801 100644
--- a/apisix/plugins/gzip.lua
+++ b/apisix/plugins/gzip.lua
@@ -31,7 +31,7 @@ local schema = {
anyOf = {
{
type = "array",
- minItem = 1,
+ minItems = 1,
items = {
type = "string",
minLength = 1,
diff --git a/t/plugin/gzip.t b/t/plugin/gzip.t
index aea85e1..e7582eb 100644
--- a/t/plugin/gzip.t
+++ b/t/plugin/gzip.t
@@ -488,3 +488,54 @@ Content-Type: text/html
--- response_headers
Content-Encoding: gzip
Vary: upstream, Accept-Encoding
+
+
+
+=== TEST 19: schema check
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ for _, case in ipairs({
+ {input = {
+ types = {}
+ }},
+ {input = {
+ min_length = 0
+ }},
+ {input = {
+ comp_level = 10
+ }},
+ {input = {
+ http_version = 2
+ }},
+ {input = {
+ buffers = {
+ number = 0,
+ size = 0,
+ }
+ }},
+ {input = {
+ vary = 0
+ }}
+ }) do
+ local code, body = t('/apisix/admin/global_rules/1',
+ ngx.HTTP_PUT,
+ {
+ id = "1",
+ plugins = {
+ ["gzip"] = case.input
+ }
+ }
+ )
+ ngx.print(body)
+ end
+ }
+}
+--- response_body
+{"error_msg":"failed to check the configuration of plugin gzip err: property \"types\" validation failed: object matches none of the requireds"}
+{"error_msg":"failed to check the configuration of plugin gzip err: property \"min_length\" validation failed: expected 0 to be greater than 1"}
+{"error_msg":"failed to check the configuration of plugin gzip err: property \"comp_level\" validation failed: expected 10 to be smaller than 9"}
+{"error_msg":"failed to check the configuration of plugin gzip err: property \"http_version\" validation failed: matches none of the enum values"}
+{"error_msg":"failed to check the configuration of plugin gzip err: property \"buffers\" validation failed: property \"number\" validation failed: expected 0 to be greater than 1"}
+{"error_msg":"failed to check the configuration of plugin gzip err: property \"vary\" validation failed: wrong type: expected boolean, got number"}