Beispiel #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
}
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
}
Beispiel #3
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
}
Beispiel #4
0
func (m *TaskCard) validateKarma(formats strfmt.Registry) error {

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

	if err := validate.Minimum("karma", "body", float64(*m.Karma), 0, true); err != nil {
		return err
	}

	if err := validate.MultipleOf("karma", "body", float64(*m.Karma), 0.5); err != nil {
		return err
	}

	return nil
}
Beispiel #5
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
}
Beispiel #6
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
}