mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-07-01 00:34:18 +08:00
cloudcommon: validators: return 400 for struct validation failure
This commit is contained in:
@@ -511,7 +511,7 @@ func (v *ValidatorStruct) Validate(data *jsonutils.JSONDict) error {
|
||||
if valueValidator, ok := v.Value.(IValidatorBase); ok {
|
||||
err = valueValidator.Validate(data)
|
||||
if err != nil {
|
||||
return err
|
||||
return newInvalidValueError(v.Key, err.Error())
|
||||
}
|
||||
}
|
||||
data.Set(v.Key, jsonutils.Marshal(v.Value))
|
||||
|
||||
Reference in New Issue
Block a user