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