tianxiaoliang commented on a change in pull request #124: Support parameter 
validation
URL: https://github.com/apache/servicecomb-kie/pull/124#discussion_r399638117
 
 

 ##########
 File path: pkg/model/db_schema.go
 ##########
 @@ -31,19 +31,19 @@ type LabelDoc struct {
 type KVDoc struct {
        ID             string `json:"id,omitempty" bson:"id,omitempty" 
yaml:"id,omitempty" swag:"string"`
        LabelID        string `json:"label_id,omitempty" 
bson:"label_id,omitempty" yaml:"label_id,omitempty"`
-       Key            string `json:"key" yaml:"key"`
-       Value          string `json:"value,omitempty" yaml:"value,omitempty"`
-       ValueType      string `json:"value_type,omitempty" 
bson:"value_type,omitempty" yaml:"value_type,omitempty"` 
//ini,json,text,yaml,properties
-       Checker        string `json:"check,omitempty" yaml:"check,omitempty"`   
                                    //python script
+       Key            string `json:"key" yaml:"key" validate:"key"`
+       Value          string `json:"value,omitempty" yaml:"value,omitempty" 
validate:"ascii,min=1,max=2097152"`
+       ValueType      string `json:"value_type,omitempty" 
bson:"value_type,omitempty" yaml:"value_type,omitempty" validate:"valueType"` 
//ini,json,text,yaml,properties
+       Checker        string `json:"check,omitempty" yaml:"check,omitempty"`   
                                                         //python script
        CreateRevision int64  `json:"create_revision,omitempty" 
bson:"create_revision," yaml:"create_revision,omitempty"`
        UpdateRevision int64  `json:"update_revision,omitempty" 
bson:"update_revision," yaml:"update_revision,omitempty"`
-       Project        string `json:"project,omitempty" 
yaml:"project,omitempty"`
-       Status         string `json:"status,omitempty" yaml:"status,omitempty"`
+       Project        string `json:"project,omitempty" 
yaml:"project,omitempty" validate:"key"`
 
 Review comment:
   如果你想复用一个规则,那最好别叫key,而是叫commonStr一类的

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to