s/ValidationErrorList/ErrorList/

This commit is contained in:
Tim Hockin
2015-11-03 13:38:40 -08:00
parent d64d1fbb3d
commit 48b49a5cae
39 changed files with 379 additions and 379 deletions

View File

@@ -70,8 +70,8 @@ func NewSwaggerSchemaFromBytes(data []byte) (Schema, error) {
// validateList unpack a list and validate every item in the list.
// It return nil if every item is ok.
// Otherwise it return an error list contain errors of every item.
func (s *SwaggerSchema) validateList(obj map[string]interface{}) validation.ValidationErrorList {
allErrs := validation.ValidationErrorList{}
func (s *SwaggerSchema) validateList(obj map[string]interface{}) validation.ErrorList {
allErrs := validation.ErrorList{}
items, exists := obj["items"]
if !exists {
return append(allErrs, fmt.Errorf("no items field in %#v", obj))
@@ -160,8 +160,8 @@ func (s *SwaggerSchema) ValidateBytes(data []byte) error {
return utilerrors.NewAggregate(allErrs)
}
func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName string) validation.ValidationErrorList {
allErrs := validation.ValidationErrorList{}
func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName string) validation.ErrorList {
allErrs := validation.ErrorList{}
models := s.api.Models
model, ok := models.At(typeName)
if !ok {
@@ -215,7 +215,7 @@ func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName stri
// This matches type name in the swagger spec, such as "v1.Binding".
var versionRegexp = regexp.MustCompile(`^v.+\..*`)
func (s *SwaggerSchema) validateField(value interface{}, fieldName, fieldType string, fieldDetails *swagger.ModelProperty) validation.ValidationErrorList {
func (s *SwaggerSchema) validateField(value interface{}, fieldName, fieldType string, fieldDetails *swagger.ModelProperty) validation.ErrorList {
// TODO: caesarxuchao: because we have multiple group/versions and objects
// may reference objects in other group, the commented out way of checking
// if a filedType is a type defined by us is outdated. We use a hacky way
@@ -229,7 +229,7 @@ func (s *SwaggerSchema) validateField(value interface{}, fieldName, fieldType st
// if strings.HasPrefix(fieldType, apiVersion) {
return s.ValidateObject(value, fieldName, fieldType)
}
allErrs := validation.ValidationErrorList{}
allErrs := validation.ErrorList{}
switch fieldType {
case "string":
// Be loose about what we accept for 'string' since we use IntOrString in a couple of places