|
@@ -455,37 +455,38 @@ var (
|
|
},
|
|
},
|
|
"accept": func(input interface{}, accept interface{}) *errs.Error {
|
|
"accept": func(input interface{}, accept interface{}) *errs.Error {
|
|
var (
|
|
var (
|
|
- acceptValues = accept.([]string)
|
|
|
|
- value = input.(string)
|
|
|
|
|
|
+ acceptValues = accept.([]interface{})
|
|
|
|
+ acceptValuesString = []string{}
|
|
|
|
+ value = input.(string)
|
|
)
|
|
)
|
|
|
|
|
|
for _, acceptValue := range acceptValues {
|
|
for _, acceptValue := range acceptValues {
|
|
- if value == acceptValue {
|
|
|
|
|
|
+ if value == acceptValue.(string) {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
+ acceptValuesString = append(acceptValuesString, acceptValue.(string))
|
|
}
|
|
}
|
|
|
|
|
|
invalidArgument := errs.InvalidArgument()
|
|
invalidArgument := errs.InvalidArgument()
|
|
invalidArgument.Message = fmt.Sprintf(
|
|
invalidArgument.Message = fmt.Sprintf(
|
|
"ValueRestriction: '%s' isn't accept. Accept [%s]",
|
|
"ValueRestriction: '%s' isn't accept. Accept [%s]",
|
|
value,
|
|
value,
|
|
- strings.Join(acceptValues, ","),
|
|
|
|
|
|
+ strings.Join(acceptValuesString, ","),
|
|
)
|
|
)
|
|
return invalidArgument
|
|
return invalidArgument
|
|
},
|
|
},
|
|
"reject": func(input interface{}, reject interface{}) *errs.Error {
|
|
"reject": func(input interface{}, reject interface{}) *errs.Error {
|
|
var (
|
|
var (
|
|
- rejectValues = reject.([]string)
|
|
|
|
|
|
+ rejectValues = reject.([]interface{})
|
|
value = input.(string)
|
|
value = input.(string)
|
|
)
|
|
)
|
|
|
|
|
|
for _, rejectValue := range rejectValues {
|
|
for _, rejectValue := range rejectValues {
|
|
- if value == rejectValue {
|
|
|
|
|
|
+ if value == rejectValue.(string) {
|
|
invalidArgument := errs.InvalidArgument()
|
|
invalidArgument := errs.InvalidArgument()
|
|
invalidArgument.Message = fmt.Sprintf(
|
|
invalidArgument.Message = fmt.Sprintf(
|
|
- "ValueRestriction: '%s' isn't accept. Rejected terms [%s]",
|
|
|
|
|
|
+ "ValueRestriction: '%s' isn't accept",
|
|
value,
|
|
value,
|
|
- strings.Join(rejectValues, ","),
|
|
|
|
)
|
|
)
|
|
return invalidArgument
|
|
return invalidArgument
|
|
}
|
|
}
|