Ejemplo n.º 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
}
func maxLengthErrorItems(path, in string, items *spec.Items) *errors.Validation {
	return errors.TooLong(path, in, *items.MaxLength)
}
Ejemplo n.º 3
0
func maxLengthError(param *spec.Parameter) *errors.Validation {
	return errors.TooLong(param.Name, param.In, *param.MaxLength)
}