This is an automated email from the ASF dual-hosted git repository.
tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-kie.git
The following commit(s) were added to refs/heads/master by this push:
new f89a952 modify key's validate rule to 0.5k (#144)
f89a952 is described below
commit f89a95284ff1f5d0f17b5348695d56843a018f24
Author: GuoYL <[email protected]>
AuthorDate: Mon Jun 29 09:07:25 2020 +0800
modify key's validate rule to 0.5k (#144)
---
pkg/validate/instance.go | 4 ++--
pkg/validate/instance_test.go | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/pkg/validate/instance.go b/pkg/validate/instance.go
index 90d3c8d..963b5ee 100644
--- a/pkg/validate/instance.go
+++ b/pkg/validate/instance.go
@@ -11,8 +11,8 @@ const (
// custom validate rules
// please use different tag names from third party tags
var customRules = []*RegexValidateRule{
- NewRule(key, commonNameRegexString, &Option{Min: 1, Max: 1024}), //1K
- NewRule("getKey", commonNameRegexString, &Option{Max: 1024}), //1K
+ NewRule(key, commonNameRegexString, &Option{Min: 1, Max: 512}), //0.5K
+ NewRule("getKey", commonNameRegexString, &Option{Max: 512}), //0.5K
NewRule("commonName", commonNameRegexString, &Option{Min: 1, Max: 256}),
NewRule("valueType", `^$|^(ini|json|text|yaml|properties)$`, nil),
NewRule("kvStatus", `^$|^(enabled|disabled)$`, nil),
diff --git a/pkg/validate/instance_test.go b/pkg/validate/instance_test.go
index 0700911..1876c4b 100644
--- a/pkg/validate/instance_test.go
+++ b/pkg/validate/instance_test.go
@@ -11,9 +11,9 @@ import (
func TestValidate(t *testing.T) {
string32 := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" //32
- string2k := "a"
- for i := 0; i < 11; i++ { //2k
- string2k = string2k + string2k
+ string512 := "a"
+ for i := 0; i < 9; i++ { //512
+ string512 = string512 + string512
}
err := validate.Init()
assert.NoError(t, err)
@@ -37,7 +37,7 @@ func TestValidate(t *testing.T) {
assert.Error(t, validate.Validate(kvDoc))
kvDoc = &model.KVDoc{Project: "a", Domain: "a",
- Key: string2k + "a",
+ Key: string512 + "a",
Value: "a",
}
assert.Error(t, validate.Validate(kvDoc))