Ejemplo n.º 1
0
func maxError(param *spec.Parameter) *errors.Validation {
	return errors.ExceedsMaximum(param.Name, param.In, *param.Maximum, param.ExclusiveMaximum)
}
func maxErrorItems(path, in string, items *spec.Items) *errors.Validation {
	return errors.ExceedsMaximum(path, in, *items.Maximum, items.ExclusiveMaximum)
}
Ejemplo n.º 3
0
// Maximum validates if a number is smaller than a given maximum
func Maximum(path, in string, data, max float64, exclusive bool) *errors.Validation {
	if (!exclusive && data > max) || (exclusive && data >= max) {
		return errors.ExceedsMaximum(path, in, max, exclusive)
	}
	return nil
}