Пример #1
0
// MaxLength validates a string for maximum length
func MaxLength(path, in, data string, maxLength int64) *errors.Validation {
	strLen := int64(utf8.RuneCount([]byte(data)))
	if strLen > maxLength {
		return errors.TooLong(path, in, maxLength)
	}
	return nil
}
Пример #2
0
func maxLengthError(param *spec.Parameter) *errors.Validation {
	return errors.TooLong(param.Name, param.In, *param.MaxLength)
}
Пример #3
0
func maxLengthErrorItems(path, in string, items *spec.Items) *errors.Validation {
	return errors.TooLong(path, in, *items.MaxLength)
}