Exemplo n.º 1
0
func (m *UpdateOrg) validateTagExpiration(formats strfmt.Registry) error {

	if err := validate.Minimum("tag_expiration", "body", float64(m.TagExpiration), 0, false); err != nil {
		return err
	}

	if err := validate.Maximum("tag_expiration", "body", float64(m.TagExpiration), 2.592e+06, false); err != nil {
		return err
	}

	return nil
}
Exemplo n.º 2
0
func (m *UserCard) validateAvailableKarma(formats strfmt.Registry) error {

	if swag.IsZero(m.AvailableKarma) { // not required
		return nil
	}

	if err := validate.Maximum("availableKarma", "body", float64(*m.AvailableKarma), 1000, true); err != nil {
		return err
	}

	return nil
}
func (o *GetOrderByIDParams) validateOrderID(formats strfmt.Registry) error {

	if err := validate.Minimum("orderId", "path", float64(o.OrderID), 1, false); err != nil {
		return err
	}

	if err := validate.Maximum("orderId", "path", float64(o.OrderID), 5, false); err != nil {
		return err
	}

	return nil
}
Exemplo n.º 4
0
func (m *TaskCard) validateSeverity(formats strfmt.Registry) error {

	if swag.IsZero(m.Severity) { // not required
		return nil
	}

	if err := validate.Minimum("severity", "body", float64(*m.Severity), 1, false); err != nil {
		return err
	}

	if err := validate.Maximum("severity", "body", float64(*m.Severity), 5, false); err != nil {
		return err
	}

	return nil
}
Exemplo n.º 5
0
func (m *TaskCard) validateEffort(formats strfmt.Registry) error {

	if swag.IsZero(m.Effort) { // not required
		return nil
	}

	if err := validate.Maximum("effort", "body", float64(*m.Effort), 27, false); err != nil {
		return err
	}

	if err := validate.MultipleOf("effort", "body", float64(*m.Effort), 3); err != nil {
		return err
	}

	return nil
}
Exemplo n.º 6
0
func (m *UpdateUser) validateTagExpiration(formats strfmt.Registry) error {

	if swag.IsZero(m.TagExpiration) { // not required
		return nil
	}

	if err := validate.Minimum("tag_expiration", "body", float64(*m.TagExpiration), 0, false); err != nil {
		return err
	}

	if err := validate.Maximum("tag_expiration", "body", float64(*m.TagExpiration), 2.592e+06, false); err != nil {
		return err
	}

	return nil
}
Exemplo n.º 7
0
func (n *numberValidator) Validate(val interface{}) *Result {
	data := n.convertToFloat(val)

	if n.MultipleOf != nil {
		if err := validate.MultipleOf(n.Path, n.In, data, *n.MultipleOf); err != nil {
			return sErr(err)
		}
	}
	if n.Maximum != nil {
		if err := validate.Maximum(n.Path, n.In, data, *n.Maximum, n.ExclusiveMaximum); err != nil {
			return sErr(err)
		}
	}
	if n.Minimum != nil {
		if err := validate.Minimum(n.Path, n.In, data, *n.Minimum, n.ExclusiveMinimum); err != nil {
			return sErr(err)
		}
	}
	result := new(Result)
	result.Inc()
	return result
}