mirror of https://github.com/vernonkeenan/lib
229 lines
5.5 KiB
Go
229 lines
5.5 KiB
Go
// 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"
|
|
stderrors "errors"
|
|
"strconv"
|
|
|
|
"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"
|
|
)
|
|
|
|
// PortfolioEnrichmentPotentialMatch One unselected authoritative alternative retained for human reconciliation; it never grants write authority
|
|
//
|
|
// swagger:model PortfolioEnrichmentPotentialMatch
|
|
type PortfolioEnrichmentPotentialMatch struct {
|
|
|
|
// match facts
|
|
// Required: true
|
|
// Max Items: 24
|
|
// Min Items: 1
|
|
MatchFacts []*PortfolioEnrichmentMatchFact `json:"MatchFacts"`
|
|
|
|
// target base version
|
|
// Required: true
|
|
// Format: date-time
|
|
TargetBaseVersion *strfmt.DateTime `json:"TargetBaseVersion"`
|
|
|
|
// target ID
|
|
// Required: true
|
|
// Max Length: 64
|
|
// Min Length: 1
|
|
// Pattern: ^[A-Za-z0-9_-]+$
|
|
TargetID *string `json:"TargetID"`
|
|
|
|
// target label
|
|
// Required: true
|
|
// Max Length: 255
|
|
// Min Length: 1
|
|
TargetLabel *string `json:"TargetLabel"`
|
|
}
|
|
|
|
// Validate validates this portfolio enrichment potential match
|
|
func (m *PortfolioEnrichmentPotentialMatch) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateMatchFacts(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTargetBaseVersion(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTargetID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTargetLabel(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentPotentialMatch) validateMatchFacts(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("MatchFacts", "body", m.MatchFacts); err != nil {
|
|
return err
|
|
}
|
|
|
|
iMatchFactsSize := int64(len(m.MatchFacts))
|
|
|
|
if err := validate.MinItems("MatchFacts", "body", iMatchFactsSize, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxItems("MatchFacts", "body", iMatchFactsSize, 24); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.MatchFacts); i++ {
|
|
if typeutils.IsZero(m.MatchFacts[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.MatchFacts[i] != nil {
|
|
if err := m.MatchFacts[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("MatchFacts" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("MatchFacts" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentPotentialMatch) validateTargetBaseVersion(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("TargetBaseVersion", "body", m.TargetBaseVersion); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("TargetBaseVersion", "body", "date-time", m.TargetBaseVersion.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentPotentialMatch) validateTargetID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("TargetID", "body", m.TargetID); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MinLength("TargetID", "body", *m.TargetID, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("TargetID", "body", *m.TargetID, 64); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Pattern("TargetID", "body", *m.TargetID, `^[A-Za-z0-9_-]+$`); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentPotentialMatch) validateTargetLabel(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("TargetLabel", "body", m.TargetLabel); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MinLength("TargetLabel", "body", *m.TargetLabel, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("TargetLabel", "body", *m.TargetLabel, 255); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this portfolio enrichment potential match based on the context it is used
|
|
func (m *PortfolioEnrichmentPotentialMatch) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateMatchFacts(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentPotentialMatch) contextValidateMatchFacts(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.MatchFacts); i++ {
|
|
|
|
if m.MatchFacts[i] != nil {
|
|
|
|
if typeutils.IsZero(m.MatchFacts[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.MatchFacts[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("MatchFacts" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("MatchFacts" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentPotentialMatch) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return jsonutils.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentPotentialMatch) UnmarshalBinary(b []byte) error {
|
|
var res PortfolioEnrichmentPotentialMatch
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|