mirror of https://github.com/vernonkeenan/lib
859 lines
22 KiB
Go
859 lines
22 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"
|
|
"encoding/json"
|
|
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"
|
|
)
|
|
|
|
// PortfolioEnrichmentCandidate One human-reviewable Product or Service candidate in portfolio_enrichment.v1; the action remains editable until an independently authorized save
|
|
//
|
|
// swagger:model PortfolioEnrichmentCandidate
|
|
type PortfolioEnrichmentCandidate struct {
|
|
|
|
// aliases
|
|
// Required: true
|
|
// Max Items: 50
|
|
Aliases []string `json:"Aliases"`
|
|
|
|
// classifications
|
|
// Required: true
|
|
// Max Items: 50
|
|
Classifications []*PortfolioEnrichmentClassification `json:"Classifications"`
|
|
|
|
// entity type
|
|
// Required: true
|
|
// Enum: ["company_product","company_service"]
|
|
EntityType *string `json:"EntityType"`
|
|
|
|
// fields
|
|
// Required: true
|
|
// Max Items: 16
|
|
// Min Items: 1
|
|
Fields []*PortfolioEnrichmentField `json:"Fields"`
|
|
|
|
// ID
|
|
// Required: true
|
|
// Format: uuid
|
|
ID *strfmt.UUID `json:"ID"`
|
|
|
|
// match facts
|
|
// Required: true
|
|
// Max Items: 24
|
|
MatchFacts []*PortfolioEnrichmentMatchFact `json:"MatchFacts"`
|
|
|
|
// normalized name
|
|
// Required: true
|
|
// Max Length: 80
|
|
// Min Length: 1
|
|
NormalizedName *string `json:"NormalizedName"`
|
|
|
|
// normalized URL
|
|
// Max Length: 255
|
|
// Format: uri
|
|
NormalizedURL strfmt.URI `json:"NormalizedURL,omitempty"`
|
|
|
|
// potential matches
|
|
// Required: true
|
|
// Max Items: 24
|
|
PotentialMatches []*PortfolioEnrichmentPotentialMatch `json:"PotentialMatches"`
|
|
|
|
// reconciliation action
|
|
// Required: true
|
|
// Enum: ["create","update","unchanged","possible_duplicate","ignore"]
|
|
ReconciliationAction *string `json:"ReconciliationAction"`
|
|
|
|
// relationships
|
|
// Required: true
|
|
// Max Items: 100
|
|
Relationships []*PortfolioEnrichmentRelationshipCandidate `json:"Relationships"`
|
|
|
|
// Server-derived native write boundary for the current reconciliation action; it does not itself authorize or perform a write
|
|
// Required: true
|
|
// Enum: ["direct_create","direct_update","governed_update_proposal","none"]
|
|
SavePath *string `json:"SavePath"`
|
|
|
|
// target base version
|
|
// Format: date-time
|
|
TargetBaseVersion strfmt.DateTime `json:"TargetBaseVersion,omitempty"`
|
|
|
|
// target ID
|
|
// Max Length: 64
|
|
// Min Length: 1
|
|
// Pattern: ^[A-Za-z0-9_-]+$
|
|
TargetID string `json:"TargetID,omitempty"`
|
|
|
|
// warnings
|
|
// Required: true
|
|
// Max Items: 24
|
|
Warnings []string `json:"Warnings"`
|
|
|
|
// worker key
|
|
// Required: true
|
|
// Max Length: 120
|
|
// Pattern: ^[a-z0-9][a-z0-9._:-]{0,119}$
|
|
WorkerKey *string `json:"WorkerKey"`
|
|
}
|
|
|
|
// Validate validates this portfolio enrichment candidate
|
|
func (m *PortfolioEnrichmentCandidate) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateAliases(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateClassifications(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateEntityType(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateFields(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateMatchFacts(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateNormalizedName(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateNormalizedURL(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validatePotentialMatches(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateReconciliationAction(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRelationships(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSavePath(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.validateWarnings(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateWorkerKey(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateAliases(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Aliases", "body", m.Aliases); err != nil {
|
|
return err
|
|
}
|
|
|
|
iAliasesSize := int64(len(m.Aliases))
|
|
|
|
if err := validate.MaxItems("Aliases", "body", iAliasesSize, 50); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Aliases); i++ {
|
|
|
|
if err := validate.MinLength("Aliases"+"."+strconv.Itoa(i), "body", m.Aliases[i], 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("Aliases"+"."+strconv.Itoa(i), "body", m.Aliases[i], 80); err != nil {
|
|
return err
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateClassifications(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Classifications", "body", m.Classifications); err != nil {
|
|
return err
|
|
}
|
|
|
|
iClassificationsSize := int64(len(m.Classifications))
|
|
|
|
if err := validate.MaxItems("Classifications", "body", iClassificationsSize, 50); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Classifications); i++ {
|
|
if typeutils.IsZero(m.Classifications[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Classifications[i] != nil {
|
|
if err := m.Classifications[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Classifications" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Classifications" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioEnrichmentCandidateTypeEntityTypePropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["company_product","company_service"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioEnrichmentCandidateTypeEntityTypePropEnum = append(portfolioEnrichmentCandidateTypeEntityTypePropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioEnrichmentCandidateEntityTypeCompanyProduct captures enum value "company_product"
|
|
PortfolioEnrichmentCandidateEntityTypeCompanyProduct string = "company_product"
|
|
|
|
// PortfolioEnrichmentCandidateEntityTypeCompanyService captures enum value "company_service"
|
|
PortfolioEnrichmentCandidateEntityTypeCompanyService string = "company_service"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioEnrichmentCandidate) validateEntityTypeEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentCandidateTypeEntityTypePropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateEntityType(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("EntityType", "body", m.EntityType); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateEntityTypeEnum("EntityType", "body", *m.EntityType); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateFields(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Fields", "body", m.Fields); err != nil {
|
|
return err
|
|
}
|
|
|
|
iFieldsSize := int64(len(m.Fields))
|
|
|
|
if err := validate.MinItems("Fields", "body", iFieldsSize, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxItems("Fields", "body", iFieldsSize, 16); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Fields); i++ {
|
|
if typeutils.IsZero(m.Fields[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Fields[i] != nil {
|
|
if err := m.Fields[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Fields" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Fields" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) 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 *PortfolioEnrichmentCandidate) 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.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 *PortfolioEnrichmentCandidate) validateNormalizedName(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("NormalizedName", "body", m.NormalizedName); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MinLength("NormalizedName", "body", *m.NormalizedName, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("NormalizedName", "body", *m.NormalizedName, 80); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateNormalizedURL(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.NormalizedURL) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MaxLength("NormalizedURL", "body", m.NormalizedURL.String(), 255); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("NormalizedURL", "body", "uri", m.NormalizedURL.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validatePotentialMatches(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("PotentialMatches", "body", m.PotentialMatches); err != nil {
|
|
return err
|
|
}
|
|
|
|
iPotentialMatchesSize := int64(len(m.PotentialMatches))
|
|
|
|
if err := validate.MaxItems("PotentialMatches", "body", iPotentialMatchesSize, 24); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.PotentialMatches); i++ {
|
|
if typeutils.IsZero(m.PotentialMatches[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.PotentialMatches[i] != nil {
|
|
if err := m.PotentialMatches[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("PotentialMatches" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("PotentialMatches" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioEnrichmentCandidateTypeReconciliationActionPropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["create","update","unchanged","possible_duplicate","ignore"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioEnrichmentCandidateTypeReconciliationActionPropEnum = append(portfolioEnrichmentCandidateTypeReconciliationActionPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioEnrichmentCandidateReconciliationActionCreate captures enum value "create"
|
|
PortfolioEnrichmentCandidateReconciliationActionCreate string = "create"
|
|
|
|
// PortfolioEnrichmentCandidateReconciliationActionUpdate captures enum value "update"
|
|
PortfolioEnrichmentCandidateReconciliationActionUpdate string = "update"
|
|
|
|
// PortfolioEnrichmentCandidateReconciliationActionUnchanged captures enum value "unchanged"
|
|
PortfolioEnrichmentCandidateReconciliationActionUnchanged string = "unchanged"
|
|
|
|
// PortfolioEnrichmentCandidateReconciliationActionPossibleDuplicate captures enum value "possible_duplicate"
|
|
PortfolioEnrichmentCandidateReconciliationActionPossibleDuplicate string = "possible_duplicate"
|
|
|
|
// PortfolioEnrichmentCandidateReconciliationActionIgnore captures enum value "ignore"
|
|
PortfolioEnrichmentCandidateReconciliationActionIgnore string = "ignore"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioEnrichmentCandidate) validateReconciliationActionEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentCandidateTypeReconciliationActionPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateReconciliationAction(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("ReconciliationAction", "body", m.ReconciliationAction); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateReconciliationActionEnum("ReconciliationAction", "body", *m.ReconciliationAction); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateRelationships(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Relationships", "body", m.Relationships); err != nil {
|
|
return err
|
|
}
|
|
|
|
iRelationshipsSize := int64(len(m.Relationships))
|
|
|
|
if err := validate.MaxItems("Relationships", "body", iRelationshipsSize, 100); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Relationships); i++ {
|
|
if typeutils.IsZero(m.Relationships[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Relationships[i] != nil {
|
|
if err := m.Relationships[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Relationships" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Relationships" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioEnrichmentCandidateTypeSavePathPropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["direct_create","direct_update","governed_update_proposal","none"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioEnrichmentCandidateTypeSavePathPropEnum = append(portfolioEnrichmentCandidateTypeSavePathPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioEnrichmentCandidateSavePathDirectCreate captures enum value "direct_create"
|
|
PortfolioEnrichmentCandidateSavePathDirectCreate string = "direct_create"
|
|
|
|
// PortfolioEnrichmentCandidateSavePathDirectUpdate captures enum value "direct_update"
|
|
PortfolioEnrichmentCandidateSavePathDirectUpdate string = "direct_update"
|
|
|
|
// PortfolioEnrichmentCandidateSavePathGovernedUpdateProposal captures enum value "governed_update_proposal"
|
|
PortfolioEnrichmentCandidateSavePathGovernedUpdateProposal string = "governed_update_proposal"
|
|
|
|
// PortfolioEnrichmentCandidateSavePathNone captures enum value "none"
|
|
PortfolioEnrichmentCandidateSavePathNone string = "none"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioEnrichmentCandidate) validateSavePathEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentCandidateTypeSavePathPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateSavePath(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("SavePath", "body", m.SavePath); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateSavePathEnum("SavePath", "body", *m.SavePath); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateTargetBaseVersion(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.TargetBaseVersion) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("TargetBaseVersion", "body", "date-time", m.TargetBaseVersion.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateTargetID(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.TargetID) { // not required
|
|
return nil
|
|
}
|
|
|
|
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 *PortfolioEnrichmentCandidate) validateWarnings(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Warnings", "body", m.Warnings); err != nil {
|
|
return err
|
|
}
|
|
|
|
iWarningsSize := int64(len(m.Warnings))
|
|
|
|
if err := validate.MaxItems("Warnings", "body", iWarningsSize, 24); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Warnings); i++ {
|
|
|
|
if err := validate.MinLength("Warnings"+"."+strconv.Itoa(i), "body", m.Warnings[i], 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("Warnings"+"."+strconv.Itoa(i), "body", m.Warnings[i], 1000); err != nil {
|
|
return err
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) validateWorkerKey(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("WorkerKey", "body", m.WorkerKey); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("WorkerKey", "body", *m.WorkerKey, 120); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Pattern("WorkerKey", "body", *m.WorkerKey, `^[a-z0-9][a-z0-9._:-]{0,119}$`); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this portfolio enrichment candidate based on the context it is used
|
|
func (m *PortfolioEnrichmentCandidate) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateClassifications(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateFields(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateMatchFacts(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidatePotentialMatches(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateRelationships(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) contextValidateClassifications(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Classifications); i++ {
|
|
|
|
if m.Classifications[i] != nil {
|
|
|
|
if typeutils.IsZero(m.Classifications[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Classifications[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Classifications" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Classifications" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) contextValidateFields(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Fields); i++ {
|
|
|
|
if m.Fields[i] != nil {
|
|
|
|
if typeutils.IsZero(m.Fields[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Fields[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Fields" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Fields" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) 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
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) contextValidatePotentialMatches(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.PotentialMatches); i++ {
|
|
|
|
if m.PotentialMatches[i] != nil {
|
|
|
|
if typeutils.IsZero(m.PotentialMatches[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.PotentialMatches[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("PotentialMatches" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("PotentialMatches" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentCandidate) contextValidateRelationships(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Relationships); i++ {
|
|
|
|
if m.Relationships[i] != nil {
|
|
|
|
if typeutils.IsZero(m.Relationships[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Relationships[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Relationships" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Relationships" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentCandidate) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return jsonutils.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentCandidate) UnmarshalBinary(b []byte) error {
|
|
var res PortfolioEnrichmentCandidate
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|