You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2021/07/10 04:03:00 UTC
[apisix] branch master updated: feat: allow additional properties
in upstream (#4570)
This is an automated email from the ASF dual-hosted git repository.
tokers 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 42ab614 feat: allow additional properties in upstream (#4570)
42ab614 is described below
commit 42ab6149272920bbab66985b90e2754a7c6cb747
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Sat Jul 10 12:02:54 2021 +0800
feat: allow additional properties in upstream (#4570)
Signed-off-by: spacewander <sp...@gmail.com>
---
apisix/schema_def.lua | 1 -
t/admin/upstream-array-nodes.t | 10 +++++-----
t/admin/upstream.t | 10 +++++-----
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index b196f71..4a588ef 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -445,7 +445,6 @@ local upstream_schema = {
{required = {"type", "nodes"}},
{required = {"type", "service_name", "discovery_type"}},
},
- additionalProperties = false,
}
-- TODO: add more nginx variable support
diff --git a/t/admin/upstream-array-nodes.t b/t/admin/upstream-array-nodes.t
index f23612d..2796612 100644
--- a/t/admin/upstream-array-nodes.t
+++ b/t/admin/upstream-array-nodes.t
@@ -292,7 +292,7 @@ no valid upstream node
-=== TEST 9: no additional properties is valid
+=== TEST 9: additional properties is valid
--- config
location /t {
content_by_lua_block {
@@ -307,19 +307,19 @@ no valid upstream node
"weight": 1
}],
"type": "roundrobin",
- "invalid_property": "/index.html"
+ "_service_name": "xyz",
+ "_discovery_type": "nacos"
}]]
)
ngx.status = code
- ngx.print(body)
+ ngx.say(body)
}
}
--- request
GET /t
---- error_code: 400
--- response_body
-{"error_msg":"invalid configuration: additional properties forbidden, found invalid_property"}
+passed
--- no_error_log
[error]
diff --git a/t/admin/upstream.t b/t/admin/upstream.t
index cebbb16..270d20a 100644
--- a/t/admin/upstream.t
+++ b/t/admin/upstream.t
@@ -380,7 +380,7 @@ GET /t
-=== TEST 11: no additional properties is valid
+=== TEST 11: additional properties is valid
--- config
location /t {
content_by_lua_block {
@@ -393,19 +393,19 @@ GET /t
"127.0.0.1:8080": 1
},
"type": "roundrobin",
- "invalid_property": "/index.html"
+ "_service_name": "xyz",
+ "_discovery_type": "nacos"
}]]
)
ngx.status = code
- ngx.print(body)
+ ngx.say(body)
}
}
--- request
GET /t
---- error_code: 400
--- response_body
-{"error_msg":"invalid configuration: additional properties forbidden, found invalid_property"}
+passed
--- no_error_log
[error]