go-kimai/models/meta_field_rule.go

196 lines
3.8 KiB
Go
Raw Normal View History

2023-01-14 14:14:06 +00:00
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// MetaFieldRule meta field rule
//
// swagger:model MetaFieldRule
type MetaFieldRule struct {
// activity
Activity int64 `json:"activity,omitempty"`
// customer
Customer int64 `json:"customer,omitempty"`
// entity type
EntityType string `json:"entityType,omitempty"`
// help
// Max Length: 200
Help string `json:"help,omitempty"`
// id
ID int64 `json:"id,omitempty"`
// label
// Max Length: 50
Label string `json:"label,omitempty"`
// name
// Required: true
// Max Length: 50
// Min Length: 2
Name *string `json:"name"`
// project
Project int64 `json:"project,omitempty"`
// required
// Required: true
Required *bool `json:"required"`
// type
// Required: true
// Max Length: 100
Type *string `json:"type"`
// value
Value string `json:"value,omitempty"`
// visible
// Required: true
Visible *bool `json:"visible"`
}
// Validate validates this meta field rule
func (m *MetaFieldRule) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateHelp(formats); err != nil {
res = append(res, err)
}
if err := m.validateLabel(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateRequired(formats); err != nil {
res = append(res, err)
}
if err := m.validateType(formats); err != nil {
res = append(res, err)
}
if err := m.validateVisible(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *MetaFieldRule) validateHelp(formats strfmt.Registry) error {
if swag.IsZero(m.Help) { // not required
return nil
}
if err := validate.MaxLength("help", "body", m.Help, 200); err != nil {
return err
}
return nil
}
func (m *MetaFieldRule) validateLabel(formats strfmt.Registry) error {
if swag.IsZero(m.Label) { // not required
return nil
}
if err := validate.MaxLength("label", "body", m.Label, 50); err != nil {
return err
}
return nil
}
func (m *MetaFieldRule) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
if err := validate.MinLength("name", "body", *m.Name, 2); err != nil {
return err
}
if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil {
return err
}
return nil
}
func (m *MetaFieldRule) validateRequired(formats strfmt.Registry) error {
if err := validate.Required("required", "body", m.Required); err != nil {
return err
}
return nil
}
func (m *MetaFieldRule) validateType(formats strfmt.Registry) error {
if err := validate.Required("type", "body", m.Type); err != nil {
return err
}
if err := validate.MaxLength("type", "body", *m.Type, 100); err != nil {
return err
}
return nil
}
func (m *MetaFieldRule) validateVisible(formats strfmt.Registry) error {
if err := validate.Required("visible", "body", m.Visible); err != nil {
return err
}
return nil
}
// ContextValidate validates this meta field rule based on context it is used
func (m *MetaFieldRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *MetaFieldRule) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *MetaFieldRule) UnmarshalBinary(b []byte) error {
var res MetaFieldRule
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}