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 d974c18 change: use draft7 style of JSON Schema. (#2100) d974c18 is described below commit d974c1871a981150d5f48ed370ee5307a82c6e0f Author: YuanSheng Wang <membp...@gmail.com> AuthorDate: Sat Aug 22 21:43:21 2020 +0800 change: use draft7 style of JSON Schema. (#2100) fix #2083. --- apisix/plugins/basic-auth.lua | 20 ++++++++++++++------ t/plugin/basic-auth.t | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apisix/plugins/basic-auth.lua b/apisix/plugins/basic-auth.lua index 70325c0..352f11d 100644 --- a/apisix/plugins/basic-auth.lua +++ b/apisix/plugins/basic-auth.lua @@ -26,13 +26,21 @@ local lrucache = core.lrucache.new({ local schema = { type = "object", - properties = { - username = { type = "string" }, - password = { type = "string" }, - }, oneOf = { - {required = {"username", "password"}}, - {required = {}} + { + title = "work with route or service object", + properties = { + username = { type = "string" }, + password = { type = "string" }, + }, + required = {"username", "password"}, + additionalProperties = false, + }, + { + title = "work with consumer object", + properties = {}, + additionalProperties = false, + } } } diff --git a/t/plugin/basic-auth.t b/t/plugin/basic-auth.t index 464bb02..85a67ba 100644 --- a/t/plugin/basic-auth.t +++ b/t/plugin/basic-auth.t @@ -62,7 +62,7 @@ done --- request GET /t --- response_body -property "username" validation failed: wrong type: expected string, got number +value should match only one schema, but matches none done --- no_error_log [error]