//go:build !disable_pgv
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: envoy/config/common/matcher/v3/matcher.proto

package matcherv3

import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"sort"
	"strings"
	"time"
	"unicode/utf8"

	"google.golang.org/protobuf/types/known/anypb"
)

// ensure the imports are used
var (
	_ = bytes.MinRead
	_ = errors.New("")
	_ = fmt.Print
	_ = utf8.UTFMax
	_ = (*regexp.Regexp)(nil)
	_ = (*strings.Reader)(nil)
	_ = net.IPv4len
	_ = time.Duration(0)
	_ = (*url.URL)(nil)
	_ = (*mail.Address)(nil)
	_ = anypb.Any{}
	_ = sort.Sort
)

// Validate checks the field values on Matcher with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *Matcher) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Matcher with the rules defined in the
// proto definition for this message. If any rules are violated, the result is
// a list of violation errors wrapped in MatcherMultiError, or nil if none found.
func (m *Matcher) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if all {
		switch v := interface{}(m.GetOnNoMatch()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, MatcherValidationError{
					field:  "OnNoMatch",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, MatcherValidationError{
					field:  "OnNoMatch",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetOnNoMatch()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return MatcherValidationError{
				field:  "OnNoMatch",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	oneofMatcherTypePresent := false
	switch v := m.MatcherType.(type) {
	case *Matcher_MatcherList_:
		if v == nil {
			err := MatcherValidationError{
				field:  "MatcherType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatcherTypePresent = true

		if all {
			switch v := interface{}(m.GetMatcherList()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatcherValidationError{
						field:  "MatcherList",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatcherValidationError{
						field:  "MatcherList",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetMatcherList()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatcherValidationError{
					field:  "MatcherList",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherTree_:
		if v == nil {
			err := MatcherValidationError{
				field:  "MatcherType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatcherTypePresent = true

		if all {
			switch v := interface{}(m.GetMatcherTree()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatcherValidationError{
						field:  "MatcherTree",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatcherValidationError{
						field:  "MatcherTree",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetMatcherTree()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatcherValidationError{
					field:  "MatcherTree",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofMatcherTypePresent {
		err := MatcherValidationError{
			field:  "MatcherType",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return MatcherMultiError(errors)
	}

	return nil
}

// MatcherMultiError is an error wrapping multiple validation errors returned
// by Matcher.ValidateAll() if the designated constraints aren't met.
type MatcherMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m MatcherMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m MatcherMultiError) AllErrors() []error { return m }

// MatcherValidationError is the validation error returned by Matcher.Validate
// if the designated constraints aren't met.
type MatcherValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e MatcherValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e MatcherValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e MatcherValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e MatcherValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e MatcherValidationError) ErrorName() string { return "MatcherValidationError" }

// Error satisfies the builtin error interface
func (e MatcherValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = MatcherValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = MatcherValidationError{}

// Validate checks the field values on MatchPredicate with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *MatchPredicate) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on MatchPredicate with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in MatchPredicateMultiError,
// or nil if none found.
func (m *MatchPredicate) ValidateAll() error {
	return m.validate(true)
}

func (m *MatchPredicate) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	oneofRulePresent := false
	switch v := m.Rule.(type) {
	case *MatchPredicate_OrMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetOrMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "OrMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "OrMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetOrMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "OrMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *MatchPredicate_AndMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetAndMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "AndMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "AndMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetAndMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "AndMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *MatchPredicate_NotMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetNotMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "NotMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "NotMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetNotMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "NotMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *MatchPredicate_AnyMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if m.GetAnyMatch() != true {
			err := MatchPredicateValidationError{
				field:  "AnyMatch",
				reason: "value must equal true",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	case *MatchPredicate_HttpRequestHeadersMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetHttpRequestHeadersMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpRequestHeadersMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpRequestHeadersMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetHttpRequestHeadersMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "HttpRequestHeadersMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *MatchPredicate_HttpRequestTrailersMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetHttpRequestTrailersMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpRequestTrailersMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpRequestTrailersMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetHttpRequestTrailersMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "HttpRequestTrailersMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *MatchPredicate_HttpResponseHeadersMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetHttpResponseHeadersMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpResponseHeadersMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpResponseHeadersMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetHttpResponseHeadersMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "HttpResponseHeadersMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *MatchPredicate_HttpResponseTrailersMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetHttpResponseTrailersMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpResponseTrailersMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpResponseTrailersMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetHttpResponseTrailersMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "HttpResponseTrailersMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *MatchPredicate_HttpRequestGenericBodyMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetHttpRequestGenericBodyMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpRequestGenericBodyMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpRequestGenericBodyMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetHttpRequestGenericBodyMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "HttpRequestGenericBodyMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *MatchPredicate_HttpResponseGenericBodyMatch:
		if v == nil {
			err := MatchPredicateValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if all {
			switch v := interface{}(m.GetHttpResponseGenericBodyMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpResponseGenericBodyMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicateValidationError{
						field:  "HttpResponseGenericBodyMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetHttpResponseGenericBodyMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicateValidationError{
					field:  "HttpResponseGenericBodyMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofRulePresent {
		err := MatchPredicateValidationError{
			field:  "Rule",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return MatchPredicateMultiError(errors)
	}

	return nil
}

// MatchPredicateMultiError is an error wrapping multiple validation errors
// returned by MatchPredicate.ValidateAll() if the designated constraints
// aren't met.
type MatchPredicateMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m MatchPredicateMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m MatchPredicateMultiError) AllErrors() []error { return m }

// MatchPredicateValidationError is the validation error returned by
// MatchPredicate.Validate if the designated constraints aren't met.
type MatchPredicateValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e MatchPredicateValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e MatchPredicateValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e MatchPredicateValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e MatchPredicateValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e MatchPredicateValidationError) ErrorName() string { return "MatchPredicateValidationError" }

// Error satisfies the builtin error interface
func (e MatchPredicateValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatchPredicate.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = MatchPredicateValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = MatchPredicateValidationError{}

// Validate checks the field values on HttpHeadersMatch with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *HttpHeadersMatch) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on HttpHeadersMatch with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// HttpHeadersMatchMultiError, or nil if none found.
func (m *HttpHeadersMatch) ValidateAll() error {
	return m.validate(true)
}

func (m *HttpHeadersMatch) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	for idx, item := range m.GetHeaders() {
		_, _ = idx, item

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, HttpHeadersMatchValidationError{
						field:  fmt.Sprintf("Headers[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, HttpHeadersMatchValidationError{
						field:  fmt.Sprintf("Headers[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return HttpHeadersMatchValidationError{
					field:  fmt.Sprintf("Headers[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	if len(errors) > 0 {
		return HttpHeadersMatchMultiError(errors)
	}

	return nil
}

// HttpHeadersMatchMultiError is an error wrapping multiple validation errors
// returned by HttpHeadersMatch.ValidateAll() if the designated constraints
// aren't met.
type HttpHeadersMatchMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m HttpHeadersMatchMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m HttpHeadersMatchMultiError) AllErrors() []error { return m }

// HttpHeadersMatchValidationError is the validation error returned by
// HttpHeadersMatch.Validate if the designated constraints aren't met.
type HttpHeadersMatchValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e HttpHeadersMatchValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e HttpHeadersMatchValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e HttpHeadersMatchValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e HttpHeadersMatchValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e HttpHeadersMatchValidationError) ErrorName() string { return "HttpHeadersMatchValidationError" }

// Error satisfies the builtin error interface
func (e HttpHeadersMatchValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sHttpHeadersMatch.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = HttpHeadersMatchValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = HttpHeadersMatchValidationError{}

// Validate checks the field values on HttpGenericBodyMatch with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *HttpGenericBodyMatch) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on HttpGenericBodyMatch with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// HttpGenericBodyMatchMultiError, or nil if none found.
func (m *HttpGenericBodyMatch) ValidateAll() error {
	return m.validate(true)
}

func (m *HttpGenericBodyMatch) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	// no validation rules for BytesLimit

	if len(m.GetPatterns()) < 1 {
		err := HttpGenericBodyMatchValidationError{
			field:  "Patterns",
			reason: "value must contain at least 1 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetPatterns() {
		_, _ = idx, item

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, HttpGenericBodyMatchValidationError{
						field:  fmt.Sprintf("Patterns[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, HttpGenericBodyMatchValidationError{
						field:  fmt.Sprintf("Patterns[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return HttpGenericBodyMatchValidationError{
					field:  fmt.Sprintf("Patterns[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	if len(errors) > 0 {
		return HttpGenericBodyMatchMultiError(errors)
	}

	return nil
}

// HttpGenericBodyMatchMultiError is an error wrapping multiple validation
// errors returned by HttpGenericBodyMatch.ValidateAll() if the designated
// constraints aren't met.
type HttpGenericBodyMatchMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m HttpGenericBodyMatchMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m HttpGenericBodyMatchMultiError) AllErrors() []error { return m }

// HttpGenericBodyMatchValidationError is the validation error returned by
// HttpGenericBodyMatch.Validate if the designated constraints aren't met.
type HttpGenericBodyMatchValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e HttpGenericBodyMatchValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e HttpGenericBodyMatchValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e HttpGenericBodyMatchValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e HttpGenericBodyMatchValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e HttpGenericBodyMatchValidationError) ErrorName() string {
	return "HttpGenericBodyMatchValidationError"
}

// Error satisfies the builtin error interface
func (e HttpGenericBodyMatchValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sHttpGenericBodyMatch.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = HttpGenericBodyMatchValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = HttpGenericBodyMatchValidationError{}

// Validate checks the field values on Matcher_OnMatch with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *Matcher_OnMatch) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Matcher_OnMatch with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// Matcher_OnMatchMultiError, or nil if none found.
func (m *Matcher_OnMatch) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher_OnMatch) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	// no validation rules for KeepMatching

	oneofOnMatchPresent := false
	switch v := m.OnMatch.(type) {
	case *Matcher_OnMatch_Matcher:
		if v == nil {
			err := Matcher_OnMatchValidationError{
				field:  "OnMatch",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofOnMatchPresent = true

		if all {
			switch v := interface{}(m.GetMatcher()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_OnMatchValidationError{
						field:  "Matcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_OnMatchValidationError{
						field:  "Matcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_OnMatchValidationError{
					field:  "Matcher",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_OnMatch_Action:
		if v == nil {
			err := Matcher_OnMatchValidationError{
				field:  "OnMatch",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofOnMatchPresent = true

		if all {
			switch v := interface{}(m.GetAction()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_OnMatchValidationError{
						field:  "Action",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_OnMatchValidationError{
						field:  "Action",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_OnMatchValidationError{
					field:  "Action",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofOnMatchPresent {
		err := Matcher_OnMatchValidationError{
			field:  "OnMatch",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return Matcher_OnMatchMultiError(errors)
	}

	return nil
}

// Matcher_OnMatchMultiError is an error wrapping multiple validation errors
// returned by Matcher_OnMatch.ValidateAll() if the designated constraints
// aren't met.
type Matcher_OnMatchMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_OnMatchMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m Matcher_OnMatchMultiError) AllErrors() []error { return m }

// Matcher_OnMatchValidationError is the validation error returned by
// Matcher_OnMatch.Validate if the designated constraints aren't met.
type Matcher_OnMatchValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e Matcher_OnMatchValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e Matcher_OnMatchValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e Matcher_OnMatchValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e Matcher_OnMatchValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e Matcher_OnMatchValidationError) ErrorName() string { return "Matcher_OnMatchValidationError" }

// Error satisfies the builtin error interface
func (e Matcher_OnMatchValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher_OnMatch.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = Matcher_OnMatchValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = Matcher_OnMatchValidationError{}

// Validate checks the field values on Matcher_MatcherList with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *Matcher_MatcherList) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Matcher_MatcherList with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// Matcher_MatcherListMultiError, or nil if none found.
func (m *Matcher_MatcherList) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher_MatcherList) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(m.GetMatchers()) < 1 {
		err := Matcher_MatcherListValidationError{
			field:  "Matchers",
			reason: "value must contain at least 1 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetMatchers() {
		_, _ = idx, item

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherListValidationError{
						field:  fmt.Sprintf("Matchers[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherListValidationError{
						field:  fmt.Sprintf("Matchers[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherListValidationError{
					field:  fmt.Sprintf("Matchers[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	if len(errors) > 0 {
		return Matcher_MatcherListMultiError(errors)
	}

	return nil
}

// Matcher_MatcherListMultiError is an error wrapping multiple validation
// errors returned by Matcher_MatcherList.ValidateAll() if the designated
// constraints aren't met.
type Matcher_MatcherListMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherListMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m Matcher_MatcherListMultiError) AllErrors() []error { return m }

// Matcher_MatcherListValidationError is the validation error returned by
// Matcher_MatcherList.Validate if the designated constraints aren't met.
type Matcher_MatcherListValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e Matcher_MatcherListValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e Matcher_MatcherListValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e Matcher_MatcherListValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e Matcher_MatcherListValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e Matcher_MatcherListValidationError) ErrorName() string {
	return "Matcher_MatcherListValidationError"
}

// Error satisfies the builtin error interface
func (e Matcher_MatcherListValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher_MatcherList.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = Matcher_MatcherListValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = Matcher_MatcherListValidationError{}

// Validate checks the field values on Matcher_MatcherTree with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *Matcher_MatcherTree) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Matcher_MatcherTree with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// Matcher_MatcherTreeMultiError, or nil if none found.
func (m *Matcher_MatcherTree) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher_MatcherTree) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if m.GetInput() == nil {
		err := Matcher_MatcherTreeValidationError{
			field:  "Input",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetInput()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, Matcher_MatcherTreeValidationError{
					field:  "Input",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, Matcher_MatcherTreeValidationError{
					field:  "Input",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return Matcher_MatcherTreeValidationError{
				field:  "Input",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	oneofTreeTypePresent := false
	switch v := m.TreeType.(type) {
	case *Matcher_MatcherTree_ExactMatchMap:
		if v == nil {
			err := Matcher_MatcherTreeValidationError{
				field:  "TreeType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofTreeTypePresent = true

		if all {
			switch v := interface{}(m.GetExactMatchMap()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "ExactMatchMap",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "ExactMatchMap",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetExactMatchMap()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherTreeValidationError{
					field:  "ExactMatchMap",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherTree_PrefixMatchMap:
		if v == nil {
			err := Matcher_MatcherTreeValidationError{
				field:  "TreeType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofTreeTypePresent = true

		if all {
			switch v := interface{}(m.GetPrefixMatchMap()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "PrefixMatchMap",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "PrefixMatchMap",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetPrefixMatchMap()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherTreeValidationError{
					field:  "PrefixMatchMap",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherTree_CustomMatch:
		if v == nil {
			err := Matcher_MatcherTreeValidationError{
				field:  "TreeType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofTreeTypePresent = true

		if all {
			switch v := interface{}(m.GetCustomMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "CustomMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "CustomMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherTreeValidationError{
					field:  "CustomMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofTreeTypePresent {
		err := Matcher_MatcherTreeValidationError{
			field:  "TreeType",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return Matcher_MatcherTreeMultiError(errors)
	}

	return nil
}

// Matcher_MatcherTreeMultiError is an error wrapping multiple validation
// errors returned by Matcher_MatcherTree.ValidateAll() if the designated
// constraints aren't met.
type Matcher_MatcherTreeMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherTreeMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m Matcher_MatcherTreeMultiError) AllErrors() []error { return m }

// Matcher_MatcherTreeValidationError is the validation error returned by
// Matcher_MatcherTree.Validate if the designated constraints aren't met.
type Matcher_MatcherTreeValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e Matcher_MatcherTreeValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e Matcher_MatcherTreeValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e Matcher_MatcherTreeValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e Matcher_MatcherTreeValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e Matcher_MatcherTreeValidationError) ErrorName() string {
	return "Matcher_MatcherTreeValidationError"
}

// Error satisfies the builtin error interface
func (e Matcher_MatcherTreeValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher_MatcherTree.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = Matcher_MatcherTreeValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = Matcher_MatcherTreeValidationError{}

// Validate checks the field values on Matcher_MatcherList_Predicate with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *Matcher_MatcherList_Predicate) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Matcher_MatcherList_Predicate with
// the rules defined in the proto definition for this message. If any rules
// are violated, the result is a list of violation errors wrapped in
// Matcher_MatcherList_PredicateMultiError, or nil if none found.
func (m *Matcher_MatcherList_Predicate) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher_MatcherList_Predicate) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	oneofMatchTypePresent := false
	switch v := m.MatchType.(type) {
	case *Matcher_MatcherList_Predicate_SinglePredicate_:
		if v == nil {
			err := Matcher_MatcherList_PredicateValidationError{
				field:  "MatchType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatchTypePresent = true

		if all {
			switch v := interface{}(m.GetSinglePredicate()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "SinglePredicate",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "SinglePredicate",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetSinglePredicate()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_PredicateValidationError{
					field:  "SinglePredicate",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherList_Predicate_OrMatcher:
		if v == nil {
			err := Matcher_MatcherList_PredicateValidationError{
				field:  "MatchType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatchTypePresent = true

		if all {
			switch v := interface{}(m.GetOrMatcher()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "OrMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "OrMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetOrMatcher()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_PredicateValidationError{
					field:  "OrMatcher",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherList_Predicate_AndMatcher:
		if v == nil {
			err := Matcher_MatcherList_PredicateValidationError{
				field:  "MatchType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatchTypePresent = true

		if all {
			switch v := interface{}(m.GetAndMatcher()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "AndMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "AndMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetAndMatcher()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_PredicateValidationError{
					field:  "AndMatcher",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherList_Predicate_NotMatcher:
		if v == nil {
			err := Matcher_MatcherList_PredicateValidationError{
				field:  "MatchType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatchTypePresent = true

		if all {
			switch v := interface{}(m.GetNotMatcher()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "NotMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "NotMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetNotMatcher()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_PredicateValidationError{
					field:  "NotMatcher",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofMatchTypePresent {
		err := Matcher_MatcherList_PredicateValidationError{
			field:  "MatchType",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return Matcher_MatcherList_PredicateMultiError(errors)
	}

	return nil
}

// Matcher_MatcherList_PredicateMultiError is an error wrapping multiple
// validation errors returned by Matcher_MatcherList_Predicate.ValidateAll()
// if the designated constraints aren't met.
type Matcher_MatcherList_PredicateMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherList_PredicateMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m Matcher_MatcherList_PredicateMultiError) AllErrors() []error { return m }

// Matcher_MatcherList_PredicateValidationError is the validation error
// returned by Matcher_MatcherList_Predicate.Validate if the designated
// constraints aren't met.
type Matcher_MatcherList_PredicateValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e Matcher_MatcherList_PredicateValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e Matcher_MatcherList_PredicateValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e Matcher_MatcherList_PredicateValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e Matcher_MatcherList_PredicateValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e Matcher_MatcherList_PredicateValidationError) ErrorName() string {
	return "Matcher_MatcherList_PredicateValidationError"
}

// Error satisfies the builtin error interface
func (e Matcher_MatcherList_PredicateValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher_MatcherList_Predicate.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = Matcher_MatcherList_PredicateValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = Matcher_MatcherList_PredicateValidationError{}

// Validate checks the field values on Matcher_MatcherList_FieldMatcher with
// the rules defined in the proto definition for this message. If any rules
// are violated, the first error encountered is returned, or nil if there are
// no violations.
func (m *Matcher_MatcherList_FieldMatcher) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Matcher_MatcherList_FieldMatcher with
// the rules defined in the proto definition for this message. If any rules
// are violated, the result is a list of violation errors wrapped in
// Matcher_MatcherList_FieldMatcherMultiError, or nil if none found.
func (m *Matcher_MatcherList_FieldMatcher) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher_MatcherList_FieldMatcher) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if m.GetPredicate() == nil {
		err := Matcher_MatcherList_FieldMatcherValidationError{
			field:  "Predicate",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetPredicate()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
					field:  "Predicate",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
					field:  "Predicate",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetPredicate()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return Matcher_MatcherList_FieldMatcherValidationError{
				field:  "Predicate",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	if m.GetOnMatch() == nil {
		err := Matcher_MatcherList_FieldMatcherValidationError{
			field:  "OnMatch",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetOnMatch()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
					field:  "OnMatch",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
					field:  "OnMatch",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return Matcher_MatcherList_FieldMatcherValidationError{
				field:  "OnMatch",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	if len(errors) > 0 {
		return Matcher_MatcherList_FieldMatcherMultiError(errors)
	}

	return nil
}

// Matcher_MatcherList_FieldMatcherMultiError is an error wrapping multiple
// validation errors returned by
// Matcher_MatcherList_FieldMatcher.ValidateAll() if the designated
// constraints aren't met.
type Matcher_MatcherList_FieldMatcherMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherList_FieldMatcherMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m Matcher_MatcherList_FieldMatcherMultiError) AllErrors() []error { return m }

// Matcher_MatcherList_FieldMatcherValidationError is the validation error
// returned by Matcher_MatcherList_FieldMatcher.Validate if the designated
// constraints aren't met.
type Matcher_MatcherList_FieldMatcherValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e Matcher_MatcherList_FieldMatcherValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e Matcher_MatcherList_FieldMatcherValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e Matcher_MatcherList_FieldMatcherValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e Matcher_MatcherList_FieldMatcherValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e Matcher_MatcherList_FieldMatcherValidationError) ErrorName() string {
	return "Matcher_MatcherList_FieldMatcherValidationError"
}

// Error satisfies the builtin error interface
func (e Matcher_MatcherList_FieldMatcherValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher_MatcherList_FieldMatcher.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = Matcher_MatcherList_FieldMatcherValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = Matcher_MatcherList_FieldMatcherValidationError{}

// Validate checks the field values on
// Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *Matcher_MatcherList_Predicate_SinglePredicate) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on
// Matcher_MatcherList_Predicate_SinglePredicate with the rules defined in the
// proto definition for this message. If any rules are violated, the result is
// a list of violation errors wrapped in
// Matcher_MatcherList_Predicate_SinglePredicateMultiError, or nil if none found.
func (m *Matcher_MatcherList_Predicate_SinglePredicate) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher_MatcherList_Predicate_SinglePredicate) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if m.GetInput() == nil {
		err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
			field:  "Input",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetInput()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
					field:  "Input",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
					field:  "Input",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
				field:  "Input",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	oneofMatcherPresent := false
	switch v := m.Matcher.(type) {
	case *Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch:
		if v == nil {
			err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
				field:  "Matcher",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatcherPresent = true

		if all {
			switch v := interface{}(m.GetValueMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
						field:  "ValueMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
						field:  "ValueMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetValueMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
					field:  "ValueMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch:
		if v == nil {
			err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
				field:  "Matcher",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatcherPresent = true

		if all {
			switch v := interface{}(m.GetCustomMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
						field:  "CustomMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
						field:  "CustomMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
					field:  "CustomMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofMatcherPresent {
		err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
			field:  "Matcher",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return Matcher_MatcherList_Predicate_SinglePredicateMultiError(errors)
	}

	return nil
}

// Matcher_MatcherList_Predicate_SinglePredicateMultiError is an error wrapping
// multiple validation errors returned by
// Matcher_MatcherList_Predicate_SinglePredicate.ValidateAll() if the
// designated constraints aren't met.
type Matcher_MatcherList_Predicate_SinglePredicateMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) AllErrors() []error { return m }

// Matcher_MatcherList_Predicate_SinglePredicateValidationError is the
// validation error returned by
// Matcher_MatcherList_Predicate_SinglePredicate.Validate if the designated
// constraints aren't met.
type Matcher_MatcherList_Predicate_SinglePredicateValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Reason() string {
	return e.reason
}

// Cause function returns cause value.
func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) ErrorName() string {
	return "Matcher_MatcherList_Predicate_SinglePredicateValidationError"
}

// Error satisfies the builtin error interface
func (e Matcher_MatcherList_Predicate_SinglePredicateValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher_MatcherList_Predicate_SinglePredicate.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}

// Validate checks the field values on
// Matcher_MatcherList_Predicate_PredicateList with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *Matcher_MatcherList_Predicate_PredicateList) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on
// Matcher_MatcherList_Predicate_PredicateList with the rules defined in the
// proto definition for this message. If any rules are violated, the result is
// a list of violation errors wrapped in
// Matcher_MatcherList_Predicate_PredicateListMultiError, or nil if none found.
func (m *Matcher_MatcherList_Predicate_PredicateList) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher_MatcherList_Predicate_PredicateList) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(m.GetPredicate()) < 2 {
		err := Matcher_MatcherList_Predicate_PredicateListValidationError{
			field:  "Predicate",
			reason: "value must contain at least 2 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetPredicate() {
		_, _ = idx, item

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{
						field:  fmt.Sprintf("Predicate[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{
						field:  fmt.Sprintf("Predicate[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_Predicate_PredicateListValidationError{
					field:  fmt.Sprintf("Predicate[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	if len(errors) > 0 {
		return Matcher_MatcherList_Predicate_PredicateListMultiError(errors)
	}

	return nil
}

// Matcher_MatcherList_Predicate_PredicateListMultiError is an error wrapping
// multiple validation errors returned by
// Matcher_MatcherList_Predicate_PredicateList.ValidateAll() if the designated
// constraints aren't met.
type Matcher_MatcherList_Predicate_PredicateListMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherList_Predicate_PredicateListMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m Matcher_MatcherList_Predicate_PredicateListMultiError) AllErrors() []error { return m }

// Matcher_MatcherList_Predicate_PredicateListValidationError is the validation
// error returned by Matcher_MatcherList_Predicate_PredicateList.Validate if
// the designated constraints aren't met.
type Matcher_MatcherList_Predicate_PredicateListValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e Matcher_MatcherList_Predicate_PredicateListValidationError) ErrorName() string {
	return "Matcher_MatcherList_Predicate_PredicateListValidationError"
}

// Error satisfies the builtin error interface
func (e Matcher_MatcherList_Predicate_PredicateListValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher_MatcherList_Predicate_PredicateList.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = Matcher_MatcherList_Predicate_PredicateListValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = Matcher_MatcherList_Predicate_PredicateListValidationError{}

// Validate checks the field values on Matcher_MatcherTree_MatchMap with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *Matcher_MatcherTree_MatchMap) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on Matcher_MatcherTree_MatchMap with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// Matcher_MatcherTree_MatchMapMultiError, or nil if none found.
func (m *Matcher_MatcherTree_MatchMap) ValidateAll() error {
	return m.validate(true)
}

func (m *Matcher_MatcherTree_MatchMap) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(m.GetMap()) < 1 {
		err := Matcher_MatcherTree_MatchMapValidationError{
			field:  "Map",
			reason: "value must contain at least 1 pair(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	{
		sorted_keys := make([]string, len(m.GetMap()))
		i := 0
		for key := range m.GetMap() {
			sorted_keys[i] = key
			i++
		}
		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
		for _, key := range sorted_keys {
			val := m.GetMap()[key]
			_ = val

			// no validation rules for Map[key]

			if all {
				switch v := interface{}(val).(type) {
				case interface{ ValidateAll() error }:
					if err := v.ValidateAll(); err != nil {
						errors = append(errors, Matcher_MatcherTree_MatchMapValidationError{
							field:  fmt.Sprintf("Map[%v]", key),
							reason: "embedded message failed validation",
							cause:  err,
						})
					}
				case interface{ Validate() error }:
					if err := v.Validate(); err != nil {
						errors = append(errors, Matcher_MatcherTree_MatchMapValidationError{
							field:  fmt.Sprintf("Map[%v]", key),
							reason: "embedded message failed validation",
							cause:  err,
						})
					}
				}
			} else if v, ok := interface{}(val).(interface{ Validate() error }); ok {
				if err := v.Validate(); err != nil {
					return Matcher_MatcherTree_MatchMapValidationError{
						field:  fmt.Sprintf("Map[%v]", key),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}

		}
	}

	if len(errors) > 0 {
		return Matcher_MatcherTree_MatchMapMultiError(errors)
	}

	return nil
}

// Matcher_MatcherTree_MatchMapMultiError is an error wrapping multiple
// validation errors returned by Matcher_MatcherTree_MatchMap.ValidateAll() if
// the designated constraints aren't met.
type Matcher_MatcherTree_MatchMapMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherTree_MatchMapMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m Matcher_MatcherTree_MatchMapMultiError) AllErrors() []error { return m }

// Matcher_MatcherTree_MatchMapValidationError is the validation error returned
// by Matcher_MatcherTree_MatchMap.Validate if the designated constraints
// aren't met.
type Matcher_MatcherTree_MatchMapValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e Matcher_MatcherTree_MatchMapValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e Matcher_MatcherTree_MatchMapValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e Matcher_MatcherTree_MatchMapValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e Matcher_MatcherTree_MatchMapValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e Matcher_MatcherTree_MatchMapValidationError) ErrorName() string {
	return "Matcher_MatcherTree_MatchMapValidationError"
}

// Error satisfies the builtin error interface
func (e Matcher_MatcherTree_MatchMapValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatcher_MatcherTree_MatchMap.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = Matcher_MatcherTree_MatchMapValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = Matcher_MatcherTree_MatchMapValidationError{}

// Validate checks the field values on MatchPredicate_MatchSet with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *MatchPredicate_MatchSet) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on MatchPredicate_MatchSet with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// MatchPredicate_MatchSetMultiError, or nil if none found.
func (m *MatchPredicate_MatchSet) ValidateAll() error {
	return m.validate(true)
}

func (m *MatchPredicate_MatchSet) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(m.GetRules()) < 2 {
		err := MatchPredicate_MatchSetValidationError{
			field:  "Rules",
			reason: "value must contain at least 2 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetRules() {
		_, _ = idx, item

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatchPredicate_MatchSetValidationError{
						field:  fmt.Sprintf("Rules[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatchPredicate_MatchSetValidationError{
						field:  fmt.Sprintf("Rules[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatchPredicate_MatchSetValidationError{
					field:  fmt.Sprintf("Rules[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

	if len(errors) > 0 {
		return MatchPredicate_MatchSetMultiError(errors)
	}

	return nil
}

// MatchPredicate_MatchSetMultiError is an error wrapping multiple validation
// errors returned by MatchPredicate_MatchSet.ValidateAll() if the designated
// constraints aren't met.
type MatchPredicate_MatchSetMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m MatchPredicate_MatchSetMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m MatchPredicate_MatchSetMultiError) AllErrors() []error { return m }

// MatchPredicate_MatchSetValidationError is the validation error returned by
// MatchPredicate_MatchSet.Validate if the designated constraints aren't met.
type MatchPredicate_MatchSetValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e MatchPredicate_MatchSetValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e MatchPredicate_MatchSetValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e MatchPredicate_MatchSetValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e MatchPredicate_MatchSetValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e MatchPredicate_MatchSetValidationError) ErrorName() string {
	return "MatchPredicate_MatchSetValidationError"
}

// Error satisfies the builtin error interface
func (e MatchPredicate_MatchSetValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sMatchPredicate_MatchSet.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = MatchPredicate_MatchSetValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = MatchPredicate_MatchSetValidationError{}

// Validate checks the field values on HttpGenericBodyMatch_GenericTextMatch
// with the rules defined in the proto definition for this message. If any
// rules are violated, the first error encountered is returned, or nil if
// there are no violations.
func (m *HttpGenericBodyMatch_GenericTextMatch) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on HttpGenericBodyMatch_GenericTextMatch
// with the rules defined in the proto definition for this message. If any
// rules are violated, the result is a list of violation errors wrapped in
// HttpGenericBodyMatch_GenericTextMatchMultiError, or nil if none found.
func (m *HttpGenericBodyMatch_GenericTextMatch) ValidateAll() error {
	return m.validate(true)
}

func (m *HttpGenericBodyMatch_GenericTextMatch) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	oneofRulePresent := false
	switch v := m.Rule.(type) {
	case *HttpGenericBodyMatch_GenericTextMatch_StringMatch:
		if v == nil {
			err := HttpGenericBodyMatch_GenericTextMatchValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if utf8.RuneCountInString(m.GetStringMatch()) < 1 {
			err := HttpGenericBodyMatch_GenericTextMatchValidationError{
				field:  "StringMatch",
				reason: "value length must be at least 1 runes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	case *HttpGenericBodyMatch_GenericTextMatch_BinaryMatch:
		if v == nil {
			err := HttpGenericBodyMatch_GenericTextMatchValidationError{
				field:  "Rule",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRulePresent = true

		if len(m.GetBinaryMatch()) < 1 {
			err := HttpGenericBodyMatch_GenericTextMatchValidationError{
				field:  "BinaryMatch",
				reason: "value length must be at least 1 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofRulePresent {
		err := HttpGenericBodyMatch_GenericTextMatchValidationError{
			field:  "Rule",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(errors) > 0 {
		return HttpGenericBodyMatch_GenericTextMatchMultiError(errors)
	}

	return nil
}

// HttpGenericBodyMatch_GenericTextMatchMultiError is an error wrapping
// multiple validation errors returned by
// HttpGenericBodyMatch_GenericTextMatch.ValidateAll() if the designated
// constraints aren't met.
type HttpGenericBodyMatch_GenericTextMatchMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m HttpGenericBodyMatch_GenericTextMatchMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m HttpGenericBodyMatch_GenericTextMatchMultiError) AllErrors() []error { return m }

// HttpGenericBodyMatch_GenericTextMatchValidationError is the validation error
// returned by HttpGenericBodyMatch_GenericTextMatch.Validate if the
// designated constraints aren't met.
type HttpGenericBodyMatch_GenericTextMatchValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e HttpGenericBodyMatch_GenericTextMatchValidationError) ErrorName() string {
	return "HttpGenericBodyMatch_GenericTextMatchValidationError"
}

// Error satisfies the builtin error interface
func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sHttpGenericBodyMatch_GenericTextMatch.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = HttpGenericBodyMatch_GenericTextMatchValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = HttpGenericBodyMatch_GenericTextMatchValidationError{}
