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 d7593a0 feat: support '.' in id definition (#2795)
d7593a0 is described below
commit d7593a0ac3f960ab23d5a71d98cf1666e21b207c
Author: 罗泽轩 <[email protected]>
AuthorDate: Mon Nov 23 22:36:40 2020 +0800
feat: support '.' in id definition (#2795)
* feat: support '.' in id definition
Close #2274.
* tweak test
---
apisix/schema_def.lua | 2 +-
t/admin/services.t | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index df24ace..6f360ed 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -29,7 +29,7 @@ local id_schema = {
anyOf = {
{
type = "string", minLength = 1, maxLength = 64,
- pattern = [[^[a-zA-Z0-9-_]+$]]
+ pattern = [[^[a-zA-Z0-9-_.]+$]]
},
{type = "integer", minimum = 1}
}
diff --git a/t/admin/services.t b/t/admin/services.t
index fea6687..f897680 100644
--- a/t/admin/services.t
+++ b/t/admin/services.t
@@ -1441,3 +1441,49 @@ GET /t
{"error_msg":"invalid configuration: property \"name\" validation failed:
string too long, expected at most 100, got 101"}
--- no_error_log
[error]
+
+
+
+=== TEST 39: allow dot in the id
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local code, body = t('/apisix/admin/services/a.b',
+ ngx.HTTP_PUT,
+ [[{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:8080": 1
+ },
+ "type": "roundrobin"
+ },
+ "desc": "new service"
+ }]],
+ [[{
+ "node": {
+ "value": {
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:8080": 1
+ },
+ "type": "roundrobin"
+ },
+ "desc": "new service"
+ },
+ "key": "/apisix/services/a.b"
+ },
+ "action": "set"
+ }]]
+ )
+
+ ngx.status = code
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]