func minError(param *spec.Parameter) *errors.Validation {
	return errors.ExceedsMinimum(param.Name, param.In, *param.Minimum, param.ExclusiveMinimum)
}
func minErrorItems(path, in string, items *spec.Items) *errors.Validation {
	return errors.ExceedsMinimum(path, in, *items.Minimum, items.ExclusiveMinimum)
}
Esempio n. 3
0
// Minimum validates if a number is smaller than a given minimum
func Minimum(path, in string, data, min float64, exclusive bool) *errors.Validation {
	if (!exclusive && data < min) || (exclusive && data <= min) {
		return errors.ExceedsMinimum(path, in, min, exclusive)
	}
	return nil
}