This is an automated email from the ASF dual-hosted git repository.
alinsran 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 055588b08 feat(standalone): allow more characters in credential_id for
API-driven mode (#12295)
055588b08 is described below
commit 055588b085b1a1e09b768d6c086683f871bfbb50
Author: AlinsRan <[email protected]>
AuthorDate: Mon Jun 9 19:18:00 2025 +0800
feat(standalone): allow more characters in credential_id for API-driven
mode (#12295)
---
apisix/admin/standalone.lua | 2 +-
t/admin/standalone.spec.ts | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/apisix/admin/standalone.lua b/apisix/admin/standalone.lua
index ad60dff5f..c3b195432 100644
--- a/apisix/admin/standalone.lua
+++ b/apisix/admin/standalone.lua
@@ -274,7 +274,7 @@ do
type = "string",
minLength = 15,
maxLength = 128,
- pattern = [[^[a-zA-Z0-9]+/credentials/[a-zA-Z0-9]+$]],
+ pattern = [[^[a-zA-Z0-9-_]+/credentials/[a-zA-Z0-9-_.]+$]],
}
end
end
diff --git a/t/admin/standalone.spec.ts b/t/admin/standalone.spec.ts
index 7fafba02a..fdfc828fe 100644
--- a/t/admin/standalone.spec.ts
+++ b/t/admin/standalone.spec.ts
@@ -105,10 +105,10 @@ const credential1 = {
routes: routeWithKeyAuth.routes,
consumers: [
{
- "username": "john"
+ "username": "john_1"
},
{
- "id": "john/credentials/a",
+ "id": "john_1/credentials/john-a",
"plugins": {
"key-auth": {
"key": "auth-a"
@@ -116,7 +116,7 @@ const credential1 = {
}
},
{
- "id": "john/credentials/b",
+ "id": "john_1/credentials/john-b",
"plugins": {
"key-auth": {
"key": "auth-b"