// Code generated by go-swagger; DO NOT EDIT. // (c) 2012-2020 by Taxnexus, Inc. // All rights reserved worldwide. // Proprietary product; unlicensed use is not allowed package research_models import ( "context" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag/jsonutils" "github.com/go-openapi/swag/typeutils" "github.com/go-openapi/validate" ) // EnrichmentSource One cited public web source; no page body or credential data is retained // // swagger:model EnrichmentSource type EnrichmentSource struct { // ID // Required: true // Format: uuid ID *strfmt.UUID `json:"ID"` // retrieved date // Required: true // Format: date-time RetrievedDate *strfmt.DateTime `json:"RetrievedDate"` // title // Max Length: 512 Title string `json:"Title,omitempty"` // URL // Required: true // Max Length: 2048 // Format: uri URL *strfmt.URI `json:"URL"` } // Validate validates this enrichment source func (m *EnrichmentSource) Validate(formats strfmt.Registry) error { var res []error if err := m.validateID(formats); err != nil { res = append(res, err) } if err := m.validateRetrievedDate(formats); err != nil { res = append(res, err) } if err := m.validateTitle(formats); err != nil { res = append(res, err) } if err := m.validateURL(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *EnrichmentSource) validateID(formats strfmt.Registry) error { if err := validate.Required("ID", "body", m.ID); err != nil { return err } if err := validate.FormatOf("ID", "body", "uuid", m.ID.String(), formats); err != nil { return err } return nil } func (m *EnrichmentSource) validateRetrievedDate(formats strfmt.Registry) error { if err := validate.Required("RetrievedDate", "body", m.RetrievedDate); err != nil { return err } if err := validate.FormatOf("RetrievedDate", "body", "date-time", m.RetrievedDate.String(), formats); err != nil { return err } return nil } func (m *EnrichmentSource) validateTitle(formats strfmt.Registry) error { if typeutils.IsZero(m.Title) { // not required return nil } if err := validate.MaxLength("Title", "body", m.Title, 512); err != nil { return err } return nil } func (m *EnrichmentSource) validateURL(formats strfmt.Registry) error { if err := validate.Required("URL", "body", m.URL); err != nil { return err } if err := validate.MaxLength("URL", "body", m.URL.String(), 2048); err != nil { return err } if err := validate.FormatOf("URL", "body", "uri", m.URL.String(), formats); err != nil { return err } return nil } // ContextValidate validates this enrichment source based on context it is used func (m *EnrichmentSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *EnrichmentSource) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return jsonutils.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *EnrichmentSource) UnmarshalBinary(b []byte) error { var res EnrichmentSource if err := jsonutils.ReadJSON(b, &res); err != nil { return err } *m = res return nil }