diff --git a/.travis.yml b/.travis.yml index 22a78cf9ad07..c7d55d78a996 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,6 @@ addons: - perl - etcd - luarocks - - cmake - lua-check homebrew: update: true diff --git a/COPYRIGHT b/COPYRIGHT index 94e8938e375c..77e438063d14 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -46,98 +46,6 @@ https://github.com/knyar/nginx-lua-prometheus/blob/master/README.md Licensed under MIT license. %%%%%%%%% -rapidjson - -https://github.com/Tencent/rapidjson - -Tencent is pleased to support the open source community by making RapidJSON available. - -Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. - -If you have downloaded a copy of the RapidJSON binary from Tencent, please note that the RapidJSON binary is licensed under the MIT License. -If you have downloaded a copy of the RapidJSON source code from Tencent, please note that RapidJSON source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms. Your integration of RapidJSON into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within RapidJSON. To avoid the problematic JSON license in your own projects, it's sufficient to exclude the bin/jsonchecker/ directory, as it's the only code under the JSON license. -A copy of the MIT License is included in this file. - -Other dependencies and licenses: - -Open Source Software Licensed Under the BSD License: --------------------------------------------------------------------- - -The msinttypes r29 -Copyright (c) 2006-2013 Alexander Chemeris -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Open Source Software Licensed Under the JSON License: --------------------------------------------------------------------- - -json.org -Copyright (c) 2002 JSON.org -All Rights Reserved. - -JSON_checker -Copyright (c) 2002 JSON.org -All Rights Reserved. - - -Terms of the JSON License: ---------------------------------------------------- - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -The Software shall be used for Good, not Evil. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -Terms of the MIT License: --------------------------------------------------------------------- - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -%%%%%%%%% - -lua-rapidjson - -https://github.com/xpol/lua-rapidjson - -MIT License - -Copyright (C) 2015 Xpol Wan - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -%%%%%%%%% - lua-resty-healthcheck https://github.com/Kong/lua-resty-healthcheck @@ -399,3 +307,28 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +%%%%%%%%% +lua-resty-jsonschema + +MIT License + +Copyright (c) 2017 Julien Desgats + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md index 6148d81ff701..706afe7a63f5 100644 --- a/doc/install-dependencies.md +++ b/doc/install-dependencies.md @@ -20,9 +20,7 @@ sudo yum-config-manager --add-repo https://openresty.org/package/centos/openrest # install openresty, etcd and some compilation tools sudo yum install -y etcd openresty curl git automake autoconf \ - gcc pcre-devel libtool gcc-c++ luarocks cmake3 lua-devel - -sudo ln -s /usr/bin/cmake3 /usr/bin/cmake + gcc pcre-devel libtool gcc-c++ luarocks lua-devel # start etcd server sudo service etcd start @@ -41,7 +39,7 @@ sudo apt-get update # install openresty, etcd and some compilation tools sudo apt-get install -y git etcd openresty curl luarocks\ check libpcre3 libpcre3-dev libjemalloc-dev \ - libjemalloc1 build-essential libtool automake autoconf pkg-config cmake + libjemalloc1 build-essential libtool automake autoconf pkg-config # start etcd server sudo service etcd start @@ -70,7 +68,7 @@ tar -xvf etcd-v3.3.13-linux-amd64.tar.gz && \ # install openresty and some compilation tools -sudo apt-get install -y git openresty cmake curl \ +sudo apt-get install -y git openresty curl \ check libpcre3 libpcre3-dev libjemalloc-dev \ build-essential libtool automake autoconf pkg-config @@ -103,7 +101,7 @@ Mac OSX ```shell # install openresty, etcd and some compilation tools -brew install autoconf automake check pkg-config pcre cmake libtool openresty/brew/openresty etcd luarocks +brew install autoconf automake check pkg-config pcre libtool openresty/brew/openresty etcd luarocks # start etcd server with v2 protocol etcd --enable-v2=true & diff --git a/lua/apisix/core/schema.lua b/lua/apisix/core/schema.lua index 7181e5851e8d..a4844389e7c2 100644 --- a/lua/apisix/core/schema.lua +++ b/lua/apisix/core/schema.lua @@ -1,32 +1,24 @@ -local json = require('rapidjson') -local schema_validator = json.SchemaValidator -local schema_doc = json.SchemaDocument -local json_doc = json.Document +local jsonschema = require('resty.jsonschema') +local lrucache = require("apisix.core.lrucache") +local cached_validator = lrucache.new({count = 1000, ttl = 0}) +local opts = {match_pattern = ngx.re.find} -local cached_sd = require("apisix.core.lrucache").new({count = 1000, ttl = 0}) - - -local _M = {version = 0.2} +local _M = {version = 0.3} local function create_validator(schema) - local sd = schema_doc(schema) - local validator = schema_validator(sd) - - -- need to cache `validator` and `sd` object at same time - return {validator, sd} + -- local code = jsonschema.generate_validator_code(schema, opts) + -- local file2=io.output("/tmp/2.txt") + -- file2:write(code) + -- file2:close() + return jsonschema.generate_validator(schema, opts) end --- You can follow this document to write schema: --- https://github.com/Tencent/rapidjson/blob/master/bin/draft-04/schema --- rapidjson not supported `format` in draft-04 yet function _M.check(schema, json) - local validator = cached_sd(schema, nil, create_validator, schema)[1] - - local d = json_doc(json) - return validator:validate(d) + local validator = cached_validator(schema, nil, create_validator, schema) + return validator(json) end diff --git a/lua/apisix/plugins/example-plugin.lua b/lua/apisix/plugins/example-plugin.lua index b1a6c1f8c051..7e92ad3dc91d 100644 --- a/lua/apisix/plugins/example-plugin.lua +++ b/lua/apisix/plugins/example-plugin.lua @@ -1,9 +1,6 @@ local core = require("apisix.core") local balancer = require("ngx.balancer") --- You can follow this document to write schema: --- https://github.com/Tencent/rapidjson/blob/master/bin/draft-04/schema --- rapidjson not supported `format` in draft-04 yet local schema = { type = "object", properties = { diff --git a/lua/apisix/plugins/prometheus.lua b/lua/apisix/plugins/prometheus.lua index ee1352d1147a..bb0dea756f69 100644 --- a/lua/apisix/plugins/prometheus.lua +++ b/lua/apisix/plugins/prometheus.lua @@ -5,7 +5,7 @@ local plugin_name = "prometheus" local schema = { type = "object", - additionalProperties = false + additionalProperties = false, } diff --git a/lua/apisix/plugins/zipkin.lua b/lua/apisix/plugins/zipkin.lua index f3c193118b6e..942513c6ae48 100644 --- a/lua/apisix/plugins/zipkin.lua +++ b/lua/apisix/plugins/zipkin.lua @@ -9,9 +9,6 @@ local pairs = pairs local plugin_name = "zipkin" --- You can follow this document to write schema: --- https://github.com/Tencent/rapidjson/blob/master/bin/draft-04/schema --- rapidjson not supported `format` in draft-04 yet local schema = { type = "object", properties = { diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-master-0.rockspec index 3a4b28e1adca..53cf6b0266ed 100644 --- a/rockspec/apisix-master-0.rockspec +++ b/rockspec/apisix-master-0.rockspec @@ -20,7 +20,6 @@ dependencies = { "lua-resty-balancer = 0.02rc5", "lua-resty-ngxvar = 0.4", "lua-resty-jit-uuid = 0.0.7", - "rapidjson = 0.6.1", "lua-resty-healthcheck-iresty = 1.0.1", "lua-resty-jwt = 0.2.0", "lua-resty-cookie = 0.1.0", @@ -32,6 +31,7 @@ dependencies = { "luafilesystem = 1.7.0-2", "lua-tinyyaml = 0.1", "iresty-nginx-lua-prometheus = 0.20190917", + "lua-resty-jsonschema = 0.2", } build = { diff --git a/t/admin/global-rules.t b/t/admin/global-rules.t index ce21cf806760..7d29f578f636 100644 --- a/t/admin/global-rules.t +++ b/t/admin/global-rules.t @@ -219,7 +219,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"additionalProperties\" in docuement at pointer \"#\/host\""} +{"error_msg":"invalid configuration: additional properties forbidden, found host"} --- no_error_log [error] @@ -243,6 +243,6 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"required\" in docuement at pointer \"#\""} +{"error_msg":"invalid configuration: property \"plugins\" is required"} --- no_error_log [error] diff --git a/t/admin/health-check.t b/t/admin/health-check.t index d96dbe7ede4f..5a3e68c11d7b 100644 --- a/t/admin/health-check.t +++ b/t/admin/health-check.t @@ -146,7 +146,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"maximum\" in docuement at pointer \"#\/upstream\/checks\/active\/healthy\/successes\""} +{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: property \"active\" validation failed: property \"healthy\" validation failed: property \"successes\" validation failed: expected 255 to be smaller than 254"} --- no_error_log [error] @@ -176,7 +176,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"minimum\" in docuement at pointer \"#\/upstream\/checks\/active\/healthy\/successes\""} +{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: property \"active\" validation failed: property \"healthy\" validation failed: property \"successes\" validation failed: expected 0 to be greater than 1"} --- no_error_log [error] @@ -206,7 +206,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"maximum\" in docuement at pointer \"#\/upstream\/checks\/passive\/unhealthy\/http_statuses\/1\""} +{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: property \"passive\" validation failed: property \"unhealthy\" validation failed: property \"http_statuses\" validation failed: failed to validate item 2: expected 600 to be smaller than 599"} --- no_error_log [error] @@ -234,7 +234,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"enum\" in docuement at pointer \"#\/upstream\/checks\/active\/type\""} +{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: property \"active\" validation failed: property \"type\" validation failed: matches non of the enum values"} --- no_error_log [error] @@ -264,7 +264,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"uniqueItems\" in docuement at pointer \"#\/upstream\/checks\/active\/healthy\/http_statuses\/1\""} +{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: property \"active\" validation failed: property \"healthy\" validation failed: property \"http_statuses\" validation failed: expected unique items but items 2 and 1 are equal"} --- no_error_log [error] @@ -294,6 +294,6 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"type\" in docuement at pointer \"#\/upstream\/checks\/active\/unhealthy\/http_failures\""} +{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: property \"active\" validation failed: property \"unhealthy\" validation failed: property \"http_failures\" validation failed: wrong type: expected integer, got number"} --- no_error_log [error] diff --git a/t/admin/routes.t b/t/admin/routes.t index 78521553a254..31a5fed9443d 100644 --- a/t/admin/routes.t +++ b/t/admin/routes.t @@ -377,8 +377,7 @@ GET /t --- request GET /t --- error_code: 400 ---- response_body -{"error_msg":"invalid configuration: invalid \"uniqueItems\" in docuement at pointer \"#\/methods\/1\""} +--- response_body_like --- no_error_log [error] @@ -405,7 +404,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"enum\" in docuement at pointer \"#\/methods\/0\""} +{"error_msg":"invalid configuration: property \"methods\" validation failed: failed to validate item 1: matches non of the enum values"} --- no_error_log [error] @@ -432,7 +431,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/service_id\""} +{"error_msg":"invalid configuration: property \"service_id\" validation failed: object matches none of the alternatives"} --- no_error_log [error] @@ -540,7 +539,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/id\""} +{"error_msg":"invalid configuration: property \"id\" validation failed: object matches none of the alternatives"} --- no_error_log [error] @@ -567,7 +566,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/upstream_id\""} +{"error_msg":"invalid configuration: property \"upstream_id\" validation failed: object matches none of the alternatives"} --- no_error_log [error] @@ -766,7 +765,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"pattern\" in docuement at pointer \"#\/host\""} +{"error_msg":"invalid configuration: property \"host\" validation failed: failed to match pattern \"^\\\\*?[0-9a-zA-Z-.]+$\" with \"a.*.foo.com\""} --- no_error_log [error] @@ -799,7 +798,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"pattern\" in docuement at pointer \"#\/host\""} +{"error_msg":"invalid configuration: property \"host\" validation failed: failed to match pattern \"^\\\\*?[0-9a-zA-Z-.]+$\" with \"*.a.*.foo.com\""} --- no_error_log [error] @@ -934,7 +933,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/remote_addr\""} +{"error_msg":"invalid configuration: property \"remote_addr\" validation failed: object matches none of the alternatives"} --- no_error_log [error] diff --git a/t/admin/services.t b/t/admin/services.t index 13a47556d19c..51c15ab741e2 100644 --- a/t/admin/services.t +++ b/t/admin/services.t @@ -445,7 +445,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/id\""} +{"error_msg":"invalid configuration: property \"id\" validation failed: object matches none of the alternatives"} --- no_error_log [error] @@ -472,7 +472,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/id\""} +{"error_msg":"invalid configuration: property \"id\" validation failed: object matches none of the alternatives"} --- no_error_log [error] @@ -499,7 +499,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"additionalProperties\" in docuement at pointer \"#\/invalid_property\""} +{"error_msg":"invalid configuration: additional properties forbidden, found invalid_property"} --- no_error_log [error] @@ -526,7 +526,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/upstream_id\""} +{"error_msg":"invalid configuration: property \"upstream_id\" validation failed: object matches none of the alternatives"} --- no_error_log [error] diff --git a/t/admin/ssl.t b/t/admin/ssl.t index 93e5e353b888..db04d66442bb 100644 --- a/t/admin/ssl.t +++ b/t/admin/ssl.t @@ -210,7 +210,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"required\" in docuement at pointer \"#\""} +{"error_msg":"invalid configuration: property \"cert\" is required"} --- no_error_log [error] diff --git a/t/admin/upstream.t b/t/admin/upstream.t index 0bbdd5f8fe92..5a92e9afde39 100644 --- a/t/admin/upstream.t +++ b/t/admin/upstream.t @@ -219,7 +219,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"minProperties\" in docuement at pointer \"#\/nodes\""} +{"error_msg":"invalid configuration: property \"nodes\" validation failed: expect object to have at least 1 properties"} @@ -344,7 +344,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/id\""} +{"error_msg":"invalid configuration: property \"id\" validation failed: object matches none of the alternatives"} --- no_error_log [error] @@ -374,7 +374,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"anyOf\" in docuement at pointer \"#\/id\""} +{"error_msg":"invalid configuration: property \"id\" validation failed: object matches none of the alternatives"} --- no_error_log [error] @@ -405,7 +405,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"additionalProperties\" in docuement at pointer \"#\/invalid_property\""} +{"error_msg":"invalid configuration: additional properties forbidden, found invalid_property"} --- no_error_log [error] @@ -477,7 +477,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"enum\" in docuement at pointer \"#\/type\""} +{"error_msg":"invalid configuration: property \"type\" validation failed: matches non of the enum values"} --- no_error_log [error] @@ -507,7 +507,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"patternProperties\" in docuement at pointer \"#\/nodes\/127.0.0.1%3A8080\""} +{"error_msg":"invalid configuration: property \"nodes\" validation failed: failed to validate 127.0.0.1:8080 (matching \".*\"): wrong type: expected integer, got string"} --- no_error_log [error] @@ -537,7 +537,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"invalid configuration: invalid \"patternProperties\" in docuement at pointer \"#\/nodes\/127.0.0.1%3A8080\""} +{"error_msg":"invalid configuration: property \"nodes\" validation failed: failed to validate 127.0.0.1:8080 (matching \".*\"): expected -100 to be greater than 0"} --- no_error_log [error] diff --git a/t/node/invalid-upstream.t b/t/node/invalid-upstream.t index e78b07215e6f..e2c27db85b4f 100644 --- a/t/node/invalid-upstream.t +++ b/t/node/invalid-upstream.t @@ -107,7 +107,7 @@ qr/"nodes":\{"127.0.0.1:1980":1\}/ --- grep_error_log eval qr/\[error\].*/ --- grep_error_log_out eval -qr{failed to check item data of \[/apisix/upstreams\] err:invalid "enum" in docuement at pointer "#/type"} +qr{failed to check item data of \[/apisix/upstreams\] err:property "type" validation failed} diff --git a/t/plugin/example.t b/t/plugin/example.t index 771a73303629..a12a3cdfc95a 100644 --- a/t/plugin/example.t +++ b/t/plugin/example.t @@ -48,7 +48,7 @@ done --- request GET /t --- response_body -invalid "required" in docuement at pointer "#" +property "i" is required done --- no_error_log [error] @@ -71,7 +71,7 @@ done --- request GET /t --- response_body -invalid "minimum" in docuement at pointer "#/i" +property "i" validation failed: expected -1 to be greater than 0 done --- no_error_log [error] @@ -94,7 +94,7 @@ done --- request GET /t --- response_body -invalid "type" in docuement at pointer "#/s" +property "s" validation failed: wrong type: expected string, got number done --- no_error_log [error] @@ -117,7 +117,7 @@ done --- request GET /t --- response_body -invalid "type" in docuement at pointer "#/t" +property "t" validation failed: expect array to have at least 1 items done --- no_error_log [error] diff --git a/t/plugin/ip-restriction.t b/t/plugin/ip-restriction.t index dbbfadccfd34..b26f6b8edfed 100644 --- a/t/plugin/ip-restriction.t +++ b/t/plugin/ip-restriction.t @@ -120,7 +120,7 @@ qr@invalid ip address: 10.255.254.0/38@ --- request GET /t --- response_body -invalid "oneOf" in docuement at pointer "#" +value sould match only one schema, but matches none done --- no_error_log [error] @@ -144,7 +144,7 @@ done --- request GET /t --- response_body -invalid "type" in docuement at pointer "#/blacklist" +property "blacklist" validation failed: expect array to have at least 1 items done --- no_error_log [error] @@ -167,7 +167,7 @@ done --- request GET /t --- response_body -invalid "oneOf" in docuement at pointer "#" +value sould match only one schema, but matches both schemas 1 and 2 done --- no_error_log [error] @@ -549,6 +549,6 @@ GET /hello GET /t --- response_body invalid ip address: ::1/129 -invalid "anyOf" in docuement at pointer "#/whitelist/0" +property "whitelist" validation failed: failed to validate item 1: object matches none of the alternatives --- no_error_log [error] diff --git a/t/plugin/jwt-auth.t b/t/plugin/jwt-auth.t index 9747fc1c7df5..815f58cf9289 100644 --- a/t/plugin/jwt-auth.t +++ b/t/plugin/jwt-auth.t @@ -50,7 +50,7 @@ qr/{"algorithm":"HS256","secret":"\w+-\w+-\w+-\w+-\w+","exp":86400}/ --- request GET /t --- response_body -invalid "type" in docuement at pointer "#/key" +property "key" validation failed: wrong type: expected string, got number done --- no_error_log [error] diff --git a/t/plugin/key-auth.t b/t/plugin/key-auth.t index fb6d545595a5..3572f84cc65b 100644 --- a/t/plugin/key-auth.t +++ b/t/plugin/key-auth.t @@ -45,7 +45,7 @@ done --- request GET /t --- response_body -invalid "type" in docuement at pointer "#/key" +property "key" validation failed: wrong type: expected string, got number done --- no_error_log [error] diff --git a/t/plugin/limit-conn.t b/t/plugin/limit-conn.t index 4c455748a500..241fa7007564 100644 --- a/t/plugin/limit-conn.t +++ b/t/plugin/limit-conn.t @@ -92,7 +92,7 @@ done --- request GET /t --- response_body -invalid "required" in docuement at pointer "#" +property "burst" is required done --- no_error_log [error] @@ -369,7 +369,7 @@ GET /test_concurrency GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-conn err: invalid \"required\" in docuement at pointer \"#\""} +{"error_msg":"failed to check the configuration of plugin limit-conn err: property \"conn\" is required"} --- no_error_log [error] @@ -412,7 +412,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-conn err: invalid \"minimum\" in docuement at pointer \"#\/conn\""} +{"error_msg":"failed to check the configuration of plugin limit-conn err: property \"conn\" validation failed: expected -1 to be greater than 0"} --- no_error_log [error] @@ -453,7 +453,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-conn err: invalid \"required\" in docuement at pointer \"#\""} +{"error_msg":"failed to check the configuration of plugin limit-conn err: property \"conn\" is required"} --- no_error_log [error] @@ -495,7 +495,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-conn err: invalid \"minimum\" in docuement at pointer \"#\/conn\""} +{"error_msg":"failed to check the configuration of plugin limit-conn err: property \"conn\" validation failed: expected -1 to be greater than 0"} --- no_error_log [error] diff --git a/t/plugin/limit-count.t b/t/plugin/limit-count.t index ed4b7c1ca738..b4b151865ce9 100644 --- a/t/plugin/limit-count.t +++ b/t/plugin/limit-count.t @@ -56,7 +56,7 @@ done --- request GET /t --- response_body -invalid "enum" in docuement at pointer "#/key" +property "key" validation failed: matches non of the enum values done --- no_error_log [error] @@ -212,7 +212,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-count err: invalid \"required\" in docuement at pointer \"#\""} +{"error_msg":"failed to check the configuration of plugin limit-count err: property \"key\" is required"} --- no_error_log [error] @@ -254,7 +254,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-count err: invalid \"minimum\" in docuement at pointer \"#\/count\""} +{"error_msg":"failed to check the configuration of plugin limit-count err: property \"count\" validation failed: expected -100 to be greater than 0"} --- no_error_log [error] @@ -296,7 +296,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-count err: invalid \"minimum\" in docuement at pointer \"#\/count\""} +{"error_msg":"failed to check the configuration of plugin limit-count err: property \"count\" validation failed: expected -100 to be greater than 0"} --- no_error_log [error] @@ -336,7 +336,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-count err: invalid \"required\" in docuement at pointer \"#\""} +{"error_msg":"failed to check the configuration of plugin limit-count err: property \"key\" is required"} --- no_error_log [error] @@ -377,7 +377,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-count err: invalid \"minimum\" in docuement at pointer \"#\/count\""} +{"error_msg":"failed to check the configuration of plugin limit-count err: property \"count\" validation failed: expected -100 to be greater than 0"} --- no_error_log [error] @@ -418,7 +418,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-count err: invalid \"minimum\" in docuement at pointer \"#\/count\""} +{"error_msg":"failed to check the configuration of plugin limit-count err: property \"count\" validation failed: expected -100 to be greater than 0"} --- no_error_log [error] diff --git a/t/plugin/limit-req.t b/t/plugin/limit-req.t index 5d0513442ef8..bed2cf1fcd60 100644 --- a/t/plugin/limit-req.t +++ b/t/plugin/limit-req.t @@ -57,7 +57,7 @@ done --- request GET /t --- response_body -invalid "required" in docuement at pointer "#" +property "conn" is required done --- no_error_log [error] @@ -273,7 +273,7 @@ passed GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin limit-req err: invalid \"minimum\" in docuement at pointer \"#\/rate\""} +{"error_msg":"failed to check the configuration of plugin limit-req err: property \"rate\" validation failed: expected -1 to be greater than 0"} --- no_error_log [error] diff --git a/t/plugin/openid-connect.t b/t/plugin/openid-connect.t index 998dfb4386b6..491615b64154 100644 --- a/t/plugin/openid-connect.t +++ b/t/plugin/openid-connect.t @@ -45,7 +45,7 @@ done --- request GET /t --- response_body -invalid "required" in docuement at pointer "#" +property "client_id" is required done --- no_error_log [error] @@ -68,7 +68,7 @@ done --- request GET /t --- response_body -invalid "type" in docuement at pointer "#/client_id" +property "client_id" validation failed: wrong type: expected string, got number done --- no_error_log [error] diff --git a/t/plugin/prometheus.t b/t/plugin/prometheus.t index 2447e3a1c8c3..aff9aaaa32ee 100644 --- a/t/plugin/prometheus.t +++ b/t/plugin/prometheus.t @@ -59,7 +59,7 @@ done --- request GET /t --- response_body -invalid "additionalProperties" in docuement at pointer "#/invalid" +additional properties forbidden, found invalid --- no_error_log [error] @@ -174,7 +174,7 @@ qr/apisix_bandwidth\{type="egress",service="localhost"\} \d+/ GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin prometheus err: invalid \"additionalProperties\" in docuement at pointer \"#\/invalid_property\""} +{"error_msg":"failed to check the configuration of plugin prometheus err: additional properties forbidden, found invalid_property"} --- no_error_log [error] @@ -212,7 +212,7 @@ GET /t GET /t --- error_code: 400 --- response_body -{"error_msg":"failed to check the configuration of plugin prometheus err: invalid \"additionalProperties\" in docuement at pointer \"#\/invalid_property\""} +{"error_msg":"failed to check the configuration of plugin prometheus err: additional properties forbidden, found invalid_property"} --- no_error_log [error] diff --git a/t/plugin/proxy-rewrite.t b/t/plugin/proxy-rewrite.t index ef34af2c45c5..887be8188c07 100644 --- a/t/plugin/proxy-rewrite.t +++ b/t/plugin/proxy-rewrite.t @@ -66,7 +66,7 @@ done --- request GET /t --- response_body -invalid "enum" in docuement at pointer "#/scheme" +property "scheme" validation failed: matches non of the enum values done --- no_error_log [error] diff --git a/t/plugin/serverless.t b/t/plugin/serverless.t index 820a39c687e5..297bcaae9d1c 100644 --- a/t/plugin/serverless.t +++ b/t/plugin/serverless.t @@ -89,7 +89,7 @@ done --- request GET /t --- response_body -invalid "enum" in docuement at pointer "#/phase" +property "phase" validation failed: matches non of the enum values done --- no_error_log [error] diff --git a/t/plugin/zipkin.t b/t/plugin/zipkin.t index 43133020240c..53d5c424f9fa 100644 --- a/t/plugin/zipkin.t +++ b/t/plugin/zipkin.t @@ -69,7 +69,7 @@ done --- request GET /t --- response_body -invalid "minimum" in docuement at pointer "#/sample_ratio" +property "sample_ratio" validation failed: expected -0.1 to be greater than 1e-05 done --- no_error_log [error] @@ -92,7 +92,7 @@ done --- request GET /t --- response_body -invalid "maximum" in docuement at pointer "#/sample_ratio" +property "sample_ratio" validation failed: expected 2 to be smaller than 1 done --- no_error_log [error]