Beispiel #1
0
// MinLength validates a string for minimum length
func MinLength(path, in, data string, minLength int64) *errors.Validation {
	strLen := int64(utf8.RuneCount([]byte(data)))
	if strLen < minLength {
		return errors.TooShort(path, in, minLength)
	}
	return nil
}
Beispiel #2
0
func minLengthError(param *spec.Parameter) *errors.Validation {
	return errors.TooShort(param.Name, param.In, *param.MinLength)
}
Beispiel #3
0
func minLengthErrorItems(path, in string, items *spec.Items) *errors.Validation {
	return errors.TooShort(path, in, *items.MinLength)
}