cloudcommon: validators: return 400 for struct validation failure

This commit is contained in:
Yousong Zhou
2018-11-08 15:53:10 +00:00
parent 73ec3d67fa
commit 09e511883c

View File

@@ -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))