mirror of
https://dev.azure.com/schwarzit/schwarzit.stackit-public/_git/audit-go
synced 2026-02-08 17:17:25 +00:00
5122 lines
126 KiB
Go
5122 lines
126 KiB
Go
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
// source: buf/validate/validate.proto
|
|
|
|
package validate
|
|
|
|
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 MessageConstraints 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 *MessageConstraints) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on MessageConstraints 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
|
|
// MessageConstraintsMultiError, or nil if none found.
|
|
func (m *MessageConstraints) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *MessageConstraints) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
for idx, item := range m.GetCel() {
|
|
_, _ = idx, item
|
|
|
|
if all {
|
|
switch v := interface{}(item).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, MessageConstraintsValidationError{
|
|
field: fmt.Sprintf("Cel[%v]", idx),
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, MessageConstraintsValidationError{
|
|
field: fmt.Sprintf("Cel[%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 MessageConstraintsValidationError{
|
|
field: fmt.Sprintf("Cel[%v]", idx),
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.Disabled != nil {
|
|
// no validation rules for Disabled
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return MessageConstraintsMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MessageConstraintsMultiError is an error wrapping multiple validation errors
|
|
// returned by MessageConstraints.ValidateAll() if the designated constraints
|
|
// aren't met.
|
|
type MessageConstraintsMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m MessageConstraintsMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m MessageConstraintsMultiError) AllErrors() []error { return m }
|
|
|
|
// MessageConstraintsValidationError is the validation error returned by
|
|
// MessageConstraints.Validate if the designated constraints aren't met.
|
|
type MessageConstraintsValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e MessageConstraintsValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e MessageConstraintsValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e MessageConstraintsValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e MessageConstraintsValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e MessageConstraintsValidationError) ErrorName() string {
|
|
return "MessageConstraintsValidationError"
|
|
}
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e MessageConstraintsValidationError) 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 %sMessageConstraints.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = MessageConstraintsValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = MessageConstraintsValidationError{}
|
|
|
|
// Validate checks the field values on OneofConstraints 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 *OneofConstraints) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on OneofConstraints 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
|
|
// OneofConstraintsMultiError, or nil if none found.
|
|
func (m *OneofConstraints) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *OneofConstraints) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if m.Required != nil {
|
|
// no validation rules for Required
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return OneofConstraintsMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// OneofConstraintsMultiError is an error wrapping multiple validation errors
|
|
// returned by OneofConstraints.ValidateAll() if the designated constraints
|
|
// aren't met.
|
|
type OneofConstraintsMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m OneofConstraintsMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m OneofConstraintsMultiError) AllErrors() []error { return m }
|
|
|
|
// OneofConstraintsValidationError is the validation error returned by
|
|
// OneofConstraints.Validate if the designated constraints aren't met.
|
|
type OneofConstraintsValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e OneofConstraintsValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e OneofConstraintsValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e OneofConstraintsValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e OneofConstraintsValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e OneofConstraintsValidationError) ErrorName() string { return "OneofConstraintsValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e OneofConstraintsValidationError) 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 %sOneofConstraints.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = OneofConstraintsValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = OneofConstraintsValidationError{}
|
|
|
|
// Validate checks the field values on FieldConstraints 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 *FieldConstraints) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on FieldConstraints 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
|
|
// FieldConstraintsMultiError, or nil if none found.
|
|
func (m *FieldConstraints) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *FieldConstraints) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
for idx, item := range m.GetCel() {
|
|
_, _ = idx, item
|
|
|
|
if all {
|
|
switch v := interface{}(item).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: fmt.Sprintf("Cel[%v]", idx),
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: fmt.Sprintf("Cel[%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 FieldConstraintsValidationError{
|
|
field: fmt.Sprintf("Cel[%v]", idx),
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// no validation rules for Required
|
|
|
|
// no validation rules for Ignore
|
|
|
|
// no validation rules for Skipped
|
|
|
|
// no validation rules for IgnoreEmpty
|
|
|
|
switch v := m.Type.(type) {
|
|
case *FieldConstraints_Float:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetFloat()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Float",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Float",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetFloat()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Float",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Double:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetDouble()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Double",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Double",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetDouble()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Double",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Int32:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetInt32()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Int32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Int32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetInt32()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Int32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Int64:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetInt64()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Int64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Int64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetInt64()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Int64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Uint32:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUint32()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Uint32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Uint32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUint32()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Uint32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Uint64:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetUint64()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Uint64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Uint64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetUint64()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Uint64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Sint32:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetSint32()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Sint32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Sint32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetSint32()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Sint32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Sint64:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetSint64()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Sint64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Sint64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetSint64()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Sint64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Fixed32:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetFixed32()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Fixed32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Fixed32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetFixed32()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Fixed32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Fixed64:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetFixed64()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Fixed64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Fixed64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetFixed64()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Fixed64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Sfixed32:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetSfixed32()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Sfixed32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Sfixed32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetSfixed32()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Sfixed32",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Sfixed64:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetSfixed64()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Sfixed64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Sfixed64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetSfixed64()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Sfixed64",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Bool:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBool()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Bool",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Bool",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBool()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Bool",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_String_:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetString_()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "String_",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "String_",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetString_()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "String_",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Bytes:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetBytes()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Bytes",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Bytes",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetBytes()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Bytes",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Enum:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetEnum()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Enum",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Enum",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetEnum()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Enum",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Repeated:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetRepeated()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Repeated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Repeated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetRepeated()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Repeated",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Map:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetMap()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Map",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Map",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetMap()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Map",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Any:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetAny()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Any",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Any",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetAny()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Any",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Duration:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetDuration()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Duration",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Duration",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetDuration()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Duration",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *FieldConstraints_Timestamp:
|
|
if v == nil {
|
|
err := FieldConstraintsValidationError{
|
|
field: "Type",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetTimestamp()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Timestamp",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, FieldConstraintsValidationError{
|
|
field: "Timestamp",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetTimestamp()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return FieldConstraintsValidationError{
|
|
field: "Timestamp",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return FieldConstraintsMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// FieldConstraintsMultiError is an error wrapping multiple validation errors
|
|
// returned by FieldConstraints.ValidateAll() if the designated constraints
|
|
// aren't met.
|
|
type FieldConstraintsMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m FieldConstraintsMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m FieldConstraintsMultiError) AllErrors() []error { return m }
|
|
|
|
// FieldConstraintsValidationError is the validation error returned by
|
|
// FieldConstraints.Validate if the designated constraints aren't met.
|
|
type FieldConstraintsValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e FieldConstraintsValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e FieldConstraintsValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e FieldConstraintsValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e FieldConstraintsValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e FieldConstraintsValidationError) ErrorName() string { return "FieldConstraintsValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e FieldConstraintsValidationError) 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 %sFieldConstraints.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = FieldConstraintsValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = FieldConstraintsValidationError{}
|
|
|
|
// Validate checks the field values on FloatRules 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 *FloatRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on FloatRules 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 FloatRulesMultiError, or
|
|
// nil if none found.
|
|
func (m *FloatRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *FloatRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
// no validation rules for Finite
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *FloatRules_Lt:
|
|
if v == nil {
|
|
err := FloatRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *FloatRules_Lte:
|
|
if v == nil {
|
|
err := FloatRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *FloatRules_Gt:
|
|
if v == nil {
|
|
err := FloatRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *FloatRules_Gte:
|
|
if v == nil {
|
|
err := FloatRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return FloatRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// FloatRulesMultiError is an error wrapping multiple validation errors
|
|
// returned by FloatRules.ValidateAll() if the designated constraints aren't met.
|
|
type FloatRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m FloatRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m FloatRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// FloatRulesValidationError is the validation error returned by
|
|
// FloatRules.Validate if the designated constraints aren't met.
|
|
type FloatRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e FloatRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e FloatRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e FloatRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e FloatRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e FloatRulesValidationError) ErrorName() string { return "FloatRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e FloatRulesValidationError) 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 %sFloatRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = FloatRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = FloatRulesValidationError{}
|
|
|
|
// Validate checks the field values on DoubleRules 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 *DoubleRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on DoubleRules 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 DoubleRulesMultiError, or
|
|
// nil if none found.
|
|
func (m *DoubleRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *DoubleRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
// no validation rules for Finite
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *DoubleRules_Lt:
|
|
if v == nil {
|
|
err := DoubleRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *DoubleRules_Lte:
|
|
if v == nil {
|
|
err := DoubleRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *DoubleRules_Gt:
|
|
if v == nil {
|
|
err := DoubleRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *DoubleRules_Gte:
|
|
if v == nil {
|
|
err := DoubleRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return DoubleRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// DoubleRulesMultiError is an error wrapping multiple validation errors
|
|
// returned by DoubleRules.ValidateAll() if the designated constraints aren't met.
|
|
type DoubleRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m DoubleRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m DoubleRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// DoubleRulesValidationError is the validation error returned by
|
|
// DoubleRules.Validate if the designated constraints aren't met.
|
|
type DoubleRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e DoubleRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e DoubleRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e DoubleRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e DoubleRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e DoubleRulesValidationError) ErrorName() string { return "DoubleRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e DoubleRulesValidationError) 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 %sDoubleRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = DoubleRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = DoubleRulesValidationError{}
|
|
|
|
// Validate checks the field values on Int32Rules 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 *Int32Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Int32Rules 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 Int32RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *Int32Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Int32Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *Int32Rules_Lt:
|
|
if v == nil {
|
|
err := Int32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *Int32Rules_Lte:
|
|
if v == nil {
|
|
err := Int32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *Int32Rules_Gt:
|
|
if v == nil {
|
|
err := Int32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *Int32Rules_Gte:
|
|
if v == nil {
|
|
err := Int32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return Int32RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Int32RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by Int32Rules.ValidateAll() if the designated constraints aren't met.
|
|
type Int32RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m Int32RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m Int32RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// Int32RulesValidationError is the validation error returned by
|
|
// Int32Rules.Validate if the designated constraints aren't met.
|
|
type Int32RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e Int32RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e Int32RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e Int32RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e Int32RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e Int32RulesValidationError) ErrorName() string { return "Int32RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e Int32RulesValidationError) 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 %sInt32Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = Int32RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = Int32RulesValidationError{}
|
|
|
|
// Validate checks the field values on Int64Rules 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 *Int64Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Int64Rules 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 Int64RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *Int64Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Int64Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *Int64Rules_Lt:
|
|
if v == nil {
|
|
err := Int64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *Int64Rules_Lte:
|
|
if v == nil {
|
|
err := Int64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *Int64Rules_Gt:
|
|
if v == nil {
|
|
err := Int64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *Int64Rules_Gte:
|
|
if v == nil {
|
|
err := Int64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return Int64RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Int64RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by Int64Rules.ValidateAll() if the designated constraints aren't met.
|
|
type Int64RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m Int64RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m Int64RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// Int64RulesValidationError is the validation error returned by
|
|
// Int64Rules.Validate if the designated constraints aren't met.
|
|
type Int64RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e Int64RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e Int64RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e Int64RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e Int64RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e Int64RulesValidationError) ErrorName() string { return "Int64RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e Int64RulesValidationError) 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 %sInt64Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = Int64RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = Int64RulesValidationError{}
|
|
|
|
// Validate checks the field values on UInt32Rules 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 *UInt32Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on UInt32Rules 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 UInt32RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *UInt32Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *UInt32Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *UInt32Rules_Lt:
|
|
if v == nil {
|
|
err := UInt32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *UInt32Rules_Lte:
|
|
if v == nil {
|
|
err := UInt32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *UInt32Rules_Gt:
|
|
if v == nil {
|
|
err := UInt32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *UInt32Rules_Gte:
|
|
if v == nil {
|
|
err := UInt32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return UInt32RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// UInt32RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by UInt32Rules.ValidateAll() if the designated constraints aren't met.
|
|
type UInt32RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m UInt32RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m UInt32RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// UInt32RulesValidationError is the validation error returned by
|
|
// UInt32Rules.Validate if the designated constraints aren't met.
|
|
type UInt32RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e UInt32RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e UInt32RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e UInt32RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e UInt32RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e UInt32RulesValidationError) ErrorName() string { return "UInt32RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e UInt32RulesValidationError) 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 %sUInt32Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = UInt32RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = UInt32RulesValidationError{}
|
|
|
|
// Validate checks the field values on UInt64Rules 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 *UInt64Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on UInt64Rules 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 UInt64RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *UInt64Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *UInt64Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *UInt64Rules_Lt:
|
|
if v == nil {
|
|
err := UInt64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *UInt64Rules_Lte:
|
|
if v == nil {
|
|
err := UInt64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *UInt64Rules_Gt:
|
|
if v == nil {
|
|
err := UInt64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *UInt64Rules_Gte:
|
|
if v == nil {
|
|
err := UInt64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return UInt64RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// UInt64RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by UInt64Rules.ValidateAll() if the designated constraints aren't met.
|
|
type UInt64RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m UInt64RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m UInt64RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// UInt64RulesValidationError is the validation error returned by
|
|
// UInt64Rules.Validate if the designated constraints aren't met.
|
|
type UInt64RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e UInt64RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e UInt64RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e UInt64RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e UInt64RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e UInt64RulesValidationError) ErrorName() string { return "UInt64RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e UInt64RulesValidationError) 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 %sUInt64Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = UInt64RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = UInt64RulesValidationError{}
|
|
|
|
// Validate checks the field values on SInt32Rules 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 *SInt32Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on SInt32Rules 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 SInt32RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *SInt32Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *SInt32Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *SInt32Rules_Lt:
|
|
if v == nil {
|
|
err := SInt32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *SInt32Rules_Lte:
|
|
if v == nil {
|
|
err := SInt32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *SInt32Rules_Gt:
|
|
if v == nil {
|
|
err := SInt32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *SInt32Rules_Gte:
|
|
if v == nil {
|
|
err := SInt32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return SInt32RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// SInt32RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by SInt32Rules.ValidateAll() if the designated constraints aren't met.
|
|
type SInt32RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m SInt32RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m SInt32RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// SInt32RulesValidationError is the validation error returned by
|
|
// SInt32Rules.Validate if the designated constraints aren't met.
|
|
type SInt32RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e SInt32RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e SInt32RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e SInt32RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e SInt32RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e SInt32RulesValidationError) ErrorName() string { return "SInt32RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e SInt32RulesValidationError) 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 %sSInt32Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = SInt32RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = SInt32RulesValidationError{}
|
|
|
|
// Validate checks the field values on SInt64Rules 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 *SInt64Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on SInt64Rules 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 SInt64RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *SInt64Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *SInt64Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *SInt64Rules_Lt:
|
|
if v == nil {
|
|
err := SInt64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *SInt64Rules_Lte:
|
|
if v == nil {
|
|
err := SInt64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *SInt64Rules_Gt:
|
|
if v == nil {
|
|
err := SInt64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *SInt64Rules_Gte:
|
|
if v == nil {
|
|
err := SInt64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return SInt64RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// SInt64RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by SInt64Rules.ValidateAll() if the designated constraints aren't met.
|
|
type SInt64RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m SInt64RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m SInt64RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// SInt64RulesValidationError is the validation error returned by
|
|
// SInt64Rules.Validate if the designated constraints aren't met.
|
|
type SInt64RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e SInt64RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e SInt64RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e SInt64RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e SInt64RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e SInt64RulesValidationError) ErrorName() string { return "SInt64RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e SInt64RulesValidationError) 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 %sSInt64Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = SInt64RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = SInt64RulesValidationError{}
|
|
|
|
// Validate checks the field values on Fixed32Rules 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 *Fixed32Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Fixed32Rules 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 Fixed32RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *Fixed32Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Fixed32Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *Fixed32Rules_Lt:
|
|
if v == nil {
|
|
err := Fixed32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *Fixed32Rules_Lte:
|
|
if v == nil {
|
|
err := Fixed32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *Fixed32Rules_Gt:
|
|
if v == nil {
|
|
err := Fixed32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *Fixed32Rules_Gte:
|
|
if v == nil {
|
|
err := Fixed32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return Fixed32RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Fixed32RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by Fixed32Rules.ValidateAll() if the designated constraints aren't met.
|
|
type Fixed32RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m Fixed32RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m Fixed32RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// Fixed32RulesValidationError is the validation error returned by
|
|
// Fixed32Rules.Validate if the designated constraints aren't met.
|
|
type Fixed32RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e Fixed32RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e Fixed32RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e Fixed32RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e Fixed32RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e Fixed32RulesValidationError) ErrorName() string { return "Fixed32RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e Fixed32RulesValidationError) 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 %sFixed32Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = Fixed32RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = Fixed32RulesValidationError{}
|
|
|
|
// Validate checks the field values on Fixed64Rules 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 *Fixed64Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on Fixed64Rules 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 Fixed64RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *Fixed64Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *Fixed64Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *Fixed64Rules_Lt:
|
|
if v == nil {
|
|
err := Fixed64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *Fixed64Rules_Lte:
|
|
if v == nil {
|
|
err := Fixed64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *Fixed64Rules_Gt:
|
|
if v == nil {
|
|
err := Fixed64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *Fixed64Rules_Gte:
|
|
if v == nil {
|
|
err := Fixed64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return Fixed64RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Fixed64RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by Fixed64Rules.ValidateAll() if the designated constraints aren't met.
|
|
type Fixed64RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m Fixed64RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m Fixed64RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// Fixed64RulesValidationError is the validation error returned by
|
|
// Fixed64Rules.Validate if the designated constraints aren't met.
|
|
type Fixed64RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e Fixed64RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e Fixed64RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e Fixed64RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e Fixed64RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e Fixed64RulesValidationError) ErrorName() string { return "Fixed64RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e Fixed64RulesValidationError) 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 %sFixed64Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = Fixed64RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = Fixed64RulesValidationError{}
|
|
|
|
// Validate checks the field values on SFixed32Rules 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 *SFixed32Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on SFixed32Rules 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 SFixed32RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *SFixed32Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *SFixed32Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *SFixed32Rules_Lt:
|
|
if v == nil {
|
|
err := SFixed32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *SFixed32Rules_Lte:
|
|
if v == nil {
|
|
err := SFixed32RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *SFixed32Rules_Gt:
|
|
if v == nil {
|
|
err := SFixed32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *SFixed32Rules_Gte:
|
|
if v == nil {
|
|
err := SFixed32RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return SFixed32RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// SFixed32RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by SFixed32Rules.ValidateAll() if the designated constraints
|
|
// aren't met.
|
|
type SFixed32RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m SFixed32RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m SFixed32RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// SFixed32RulesValidationError is the validation error returned by
|
|
// SFixed32Rules.Validate if the designated constraints aren't met.
|
|
type SFixed32RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e SFixed32RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e SFixed32RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e SFixed32RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e SFixed32RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e SFixed32RulesValidationError) ErrorName() string { return "SFixed32RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e SFixed32RulesValidationError) 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 %sSFixed32Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = SFixed32RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = SFixed32RulesValidationError{}
|
|
|
|
// Validate checks the field values on SFixed64Rules 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 *SFixed64Rules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on SFixed64Rules 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 SFixed64RulesMultiError, or
|
|
// nil if none found.
|
|
func (m *SFixed64Rules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *SFixed64Rules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *SFixed64Rules_Lt:
|
|
if v == nil {
|
|
err := SFixed64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lt
|
|
case *SFixed64Rules_Lte:
|
|
if v == nil {
|
|
err := SFixed64RulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Lte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *SFixed64Rules_Gt:
|
|
if v == nil {
|
|
err := SFixed64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gt
|
|
case *SFixed64Rules_Gte:
|
|
if v == nil {
|
|
err := SFixed64RulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Gte
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return SFixed64RulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// SFixed64RulesMultiError is an error wrapping multiple validation errors
|
|
// returned by SFixed64Rules.ValidateAll() if the designated constraints
|
|
// aren't met.
|
|
type SFixed64RulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m SFixed64RulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m SFixed64RulesMultiError) AllErrors() []error { return m }
|
|
|
|
// SFixed64RulesValidationError is the validation error returned by
|
|
// SFixed64Rules.Validate if the designated constraints aren't met.
|
|
type SFixed64RulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e SFixed64RulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e SFixed64RulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e SFixed64RulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e SFixed64RulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e SFixed64RulesValidationError) ErrorName() string { return "SFixed64RulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e SFixed64RulesValidationError) 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 %sSFixed64Rules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = SFixed64RulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = SFixed64RulesValidationError{}
|
|
|
|
// Validate checks the field values on BoolRules 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 *BoolRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on BoolRules 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 BoolRulesMultiError, or nil
|
|
// if none found.
|
|
func (m *BoolRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *BoolRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return BoolRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// BoolRulesMultiError is an error wrapping multiple validation errors returned
|
|
// by BoolRules.ValidateAll() if the designated constraints aren't met.
|
|
type BoolRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m BoolRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m BoolRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// BoolRulesValidationError is the validation error returned by
|
|
// BoolRules.Validate if the designated constraints aren't met.
|
|
type BoolRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e BoolRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e BoolRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e BoolRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e BoolRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e BoolRulesValidationError) ErrorName() string { return "BoolRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e BoolRulesValidationError) 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 %sBoolRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = BoolRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = BoolRulesValidationError{}
|
|
|
|
// Validate checks the field values on StringRules 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 *StringRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on StringRules 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 StringRulesMultiError, or
|
|
// nil if none found.
|
|
func (m *StringRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *StringRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.WellKnown.(type) {
|
|
case *StringRules_Email:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Email
|
|
case *StringRules_Hostname:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Hostname
|
|
case *StringRules_Ip:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ip
|
|
case *StringRules_Ipv4:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ipv4
|
|
case *StringRules_Ipv6:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ipv6
|
|
case *StringRules_Uri:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Uri
|
|
case *StringRules_UriRef:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for UriRef
|
|
case *StringRules_Address:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Address
|
|
case *StringRules_Uuid:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Uuid
|
|
case *StringRules_Tuuid:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Tuuid
|
|
case *StringRules_IpWithPrefixlen:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for IpWithPrefixlen
|
|
case *StringRules_Ipv4WithPrefixlen:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ipv4WithPrefixlen
|
|
case *StringRules_Ipv6WithPrefixlen:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ipv6WithPrefixlen
|
|
case *StringRules_IpPrefix:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for IpPrefix
|
|
case *StringRules_Ipv4Prefix:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ipv4Prefix
|
|
case *StringRules_Ipv6Prefix:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ipv6Prefix
|
|
case *StringRules_HostAndPort:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for HostAndPort
|
|
case *StringRules_WellKnownRegex:
|
|
if v == nil {
|
|
err := StringRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for WellKnownRegex
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if m.Len != nil {
|
|
// no validation rules for Len
|
|
}
|
|
|
|
if m.MinLen != nil {
|
|
// no validation rules for MinLen
|
|
}
|
|
|
|
if m.MaxLen != nil {
|
|
// no validation rules for MaxLen
|
|
}
|
|
|
|
if m.LenBytes != nil {
|
|
// no validation rules for LenBytes
|
|
}
|
|
|
|
if m.MinBytes != nil {
|
|
// no validation rules for MinBytes
|
|
}
|
|
|
|
if m.MaxBytes != nil {
|
|
// no validation rules for MaxBytes
|
|
}
|
|
|
|
if m.Pattern != nil {
|
|
// no validation rules for Pattern
|
|
}
|
|
|
|
if m.Prefix != nil {
|
|
// no validation rules for Prefix
|
|
}
|
|
|
|
if m.Suffix != nil {
|
|
// no validation rules for Suffix
|
|
}
|
|
|
|
if m.Contains != nil {
|
|
// no validation rules for Contains
|
|
}
|
|
|
|
if m.NotContains != nil {
|
|
// no validation rules for NotContains
|
|
}
|
|
|
|
if m.Strict != nil {
|
|
// no validation rules for Strict
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return StringRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// StringRulesMultiError is an error wrapping multiple validation errors
|
|
// returned by StringRules.ValidateAll() if the designated constraints aren't met.
|
|
type StringRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m StringRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m StringRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// StringRulesValidationError is the validation error returned by
|
|
// StringRules.Validate if the designated constraints aren't met.
|
|
type StringRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e StringRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e StringRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e StringRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e StringRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e StringRulesValidationError) ErrorName() string { return "StringRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e StringRulesValidationError) 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 %sStringRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = StringRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = StringRulesValidationError{}
|
|
|
|
// Validate checks the field values on BytesRules 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 *BytesRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on BytesRules 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 BytesRulesMultiError, or
|
|
// nil if none found.
|
|
func (m *BytesRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *BytesRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.WellKnown.(type) {
|
|
case *BytesRules_Ip:
|
|
if v == nil {
|
|
err := BytesRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ip
|
|
case *BytesRules_Ipv4:
|
|
if v == nil {
|
|
err := BytesRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ipv4
|
|
case *BytesRules_Ipv6:
|
|
if v == nil {
|
|
err := BytesRulesValidationError{
|
|
field: "WellKnown",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for Ipv6
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if m.Len != nil {
|
|
// no validation rules for Len
|
|
}
|
|
|
|
if m.MinLen != nil {
|
|
// no validation rules for MinLen
|
|
}
|
|
|
|
if m.MaxLen != nil {
|
|
// no validation rules for MaxLen
|
|
}
|
|
|
|
if m.Pattern != nil {
|
|
// no validation rules for Pattern
|
|
}
|
|
|
|
if m.Prefix != nil {
|
|
// no validation rules for Prefix
|
|
}
|
|
|
|
if m.Suffix != nil {
|
|
// no validation rules for Suffix
|
|
}
|
|
|
|
if m.Contains != nil {
|
|
// no validation rules for Contains
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return BytesRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// BytesRulesMultiError is an error wrapping multiple validation errors
|
|
// returned by BytesRules.ValidateAll() if the designated constraints aren't met.
|
|
type BytesRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m BytesRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m BytesRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// BytesRulesValidationError is the validation error returned by
|
|
// BytesRules.Validate if the designated constraints aren't met.
|
|
type BytesRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e BytesRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e BytesRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e BytesRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e BytesRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e BytesRulesValidationError) ErrorName() string { return "BytesRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e BytesRulesValidationError) 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 %sBytesRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = BytesRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = BytesRulesValidationError{}
|
|
|
|
// Validate checks the field values on EnumRules 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 *EnumRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on EnumRules 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 EnumRulesMultiError, or nil
|
|
// if none found.
|
|
func (m *EnumRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *EnumRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if m.Const != nil {
|
|
// no validation rules for Const
|
|
}
|
|
|
|
if m.DefinedOnly != nil {
|
|
// no validation rules for DefinedOnly
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return EnumRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// EnumRulesMultiError is an error wrapping multiple validation errors returned
|
|
// by EnumRules.ValidateAll() if the designated constraints aren't met.
|
|
type EnumRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m EnumRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m EnumRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// EnumRulesValidationError is the validation error returned by
|
|
// EnumRules.Validate if the designated constraints aren't met.
|
|
type EnumRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e EnumRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e EnumRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e EnumRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e EnumRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e EnumRulesValidationError) ErrorName() string { return "EnumRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e EnumRulesValidationError) 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 %sEnumRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = EnumRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = EnumRulesValidationError{}
|
|
|
|
// Validate checks the field values on RepeatedRules 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 *RepeatedRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on RepeatedRules 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 RepeatedRulesMultiError, or
|
|
// nil if none found.
|
|
func (m *RepeatedRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *RepeatedRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if m.MinItems != nil {
|
|
// no validation rules for MinItems
|
|
}
|
|
|
|
if m.MaxItems != nil {
|
|
// no validation rules for MaxItems
|
|
}
|
|
|
|
if m.Unique != nil {
|
|
// no validation rules for Unique
|
|
}
|
|
|
|
if m.Items != nil {
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetItems()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, RepeatedRulesValidationError{
|
|
field: "Items",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, RepeatedRulesValidationError{
|
|
field: "Items",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetItems()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return RepeatedRulesValidationError{
|
|
field: "Items",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return RepeatedRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// RepeatedRulesMultiError is an error wrapping multiple validation errors
|
|
// returned by RepeatedRules.ValidateAll() if the designated constraints
|
|
// aren't met.
|
|
type RepeatedRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m RepeatedRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m RepeatedRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// RepeatedRulesValidationError is the validation error returned by
|
|
// RepeatedRules.Validate if the designated constraints aren't met.
|
|
type RepeatedRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e RepeatedRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e RepeatedRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e RepeatedRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e RepeatedRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e RepeatedRulesValidationError) ErrorName() string { return "RepeatedRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e RepeatedRulesValidationError) 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 %sRepeatedRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = RepeatedRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = RepeatedRulesValidationError{}
|
|
|
|
// Validate checks the field values on MapRules 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 *MapRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on MapRules 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 MapRulesMultiError, or nil
|
|
// if none found.
|
|
func (m *MapRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *MapRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if m.MinPairs != nil {
|
|
// no validation rules for MinPairs
|
|
}
|
|
|
|
if m.MaxPairs != nil {
|
|
// no validation rules for MaxPairs
|
|
}
|
|
|
|
if m.Keys != nil {
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetKeys()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, MapRulesValidationError{
|
|
field: "Keys",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, MapRulesValidationError{
|
|
field: "Keys",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetKeys()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return MapRulesValidationError{
|
|
field: "Keys",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.Values != nil {
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetValues()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, MapRulesValidationError{
|
|
field: "Values",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, MapRulesValidationError{
|
|
field: "Values",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetValues()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return MapRulesValidationError{
|
|
field: "Values",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return MapRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MapRulesMultiError is an error wrapping multiple validation errors returned
|
|
// by MapRules.ValidateAll() if the designated constraints aren't met.
|
|
type MapRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m MapRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m MapRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// MapRulesValidationError is the validation error returned by
|
|
// MapRules.Validate if the designated constraints aren't met.
|
|
type MapRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e MapRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e MapRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e MapRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e MapRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e MapRulesValidationError) ErrorName() string { return "MapRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e MapRulesValidationError) 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 %sMapRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = MapRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = MapRulesValidationError{}
|
|
|
|
// Validate checks the field values on AnyRules 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 *AnyRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on AnyRules 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 AnyRulesMultiError, or nil
|
|
// if none found.
|
|
func (m *AnyRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *AnyRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
if len(errors) > 0 {
|
|
return AnyRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// AnyRulesMultiError is an error wrapping multiple validation errors returned
|
|
// by AnyRules.ValidateAll() if the designated constraints aren't met.
|
|
type AnyRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m AnyRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m AnyRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// AnyRulesValidationError is the validation error returned by
|
|
// AnyRules.Validate if the designated constraints aren't met.
|
|
type AnyRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e AnyRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e AnyRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e AnyRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e AnyRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e AnyRulesValidationError) ErrorName() string { return "AnyRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e AnyRulesValidationError) 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 %sAnyRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = AnyRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = AnyRulesValidationError{}
|
|
|
|
// Validate checks the field values on DurationRules 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 *DurationRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on DurationRules 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 DurationRulesMultiError, or
|
|
// nil if none found.
|
|
func (m *DurationRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *DurationRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
for idx, item := range m.GetIn() {
|
|
_, _ = idx, item
|
|
|
|
if all {
|
|
switch v := interface{}(item).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: fmt.Sprintf("In[%v]", idx),
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: fmt.Sprintf("In[%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 DurationRulesValidationError{
|
|
field: fmt.Sprintf("In[%v]", idx),
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
for idx, item := range m.GetNotIn() {
|
|
_, _ = idx, item
|
|
|
|
if all {
|
|
switch v := interface{}(item).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: fmt.Sprintf("NotIn[%v]", idx),
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: fmt.Sprintf("NotIn[%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 DurationRulesValidationError{
|
|
field: fmt.Sprintf("NotIn[%v]", idx),
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *DurationRules_Lt:
|
|
if v == nil {
|
|
err := DurationRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetLt()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Lt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Lt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetLt()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return DurationRulesValidationError{
|
|
field: "Lt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *DurationRules_Lte:
|
|
if v == nil {
|
|
err := DurationRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetLte()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Lte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Lte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetLte()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return DurationRulesValidationError{
|
|
field: "Lte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *DurationRules_Gt:
|
|
if v == nil {
|
|
err := DurationRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetGt()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Gt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Gt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetGt()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return DurationRulesValidationError{
|
|
field: "Gt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *DurationRules_Gte:
|
|
if v == nil {
|
|
err := DurationRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetGte()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Gte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Gte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetGte()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return DurationRulesValidationError{
|
|
field: "Gte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetConst()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Const",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, DurationRulesValidationError{
|
|
field: "Const",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetConst()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return DurationRulesValidationError{
|
|
field: "Const",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return DurationRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// DurationRulesMultiError is an error wrapping multiple validation errors
|
|
// returned by DurationRules.ValidateAll() if the designated constraints
|
|
// aren't met.
|
|
type DurationRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m DurationRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m DurationRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// DurationRulesValidationError is the validation error returned by
|
|
// DurationRules.Validate if the designated constraints aren't met.
|
|
type DurationRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e DurationRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e DurationRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e DurationRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e DurationRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e DurationRulesValidationError) ErrorName() string { return "DurationRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e DurationRulesValidationError) 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 %sDurationRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = DurationRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = DurationRulesValidationError{}
|
|
|
|
// Validate checks the field values on TimestampRules 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 *TimestampRules) Validate() error {
|
|
return m.validate(false)
|
|
}
|
|
|
|
// ValidateAll checks the field values on TimestampRules 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 TimestampRulesMultiError,
|
|
// or nil if none found.
|
|
func (m *TimestampRules) ValidateAll() error {
|
|
return m.validate(true)
|
|
}
|
|
|
|
func (m *TimestampRules) validate(all bool) error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
var errors []error
|
|
|
|
switch v := m.LessThan.(type) {
|
|
case *TimestampRules_Lt:
|
|
if v == nil {
|
|
err := TimestampRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetLt()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Lt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Lt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetLt()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return TimestampRulesValidationError{
|
|
field: "Lt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *TimestampRules_Lte:
|
|
if v == nil {
|
|
err := TimestampRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetLte()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Lte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Lte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetLte()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return TimestampRulesValidationError{
|
|
field: "Lte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *TimestampRules_LtNow:
|
|
if v == nil {
|
|
err := TimestampRulesValidationError{
|
|
field: "LessThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for LtNow
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
switch v := m.GreaterThan.(type) {
|
|
case *TimestampRules_Gt:
|
|
if v == nil {
|
|
err := TimestampRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetGt()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Gt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Gt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetGt()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return TimestampRulesValidationError{
|
|
field: "Gt",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *TimestampRules_Gte:
|
|
if v == nil {
|
|
err := TimestampRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetGte()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Gte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Gte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetGte()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return TimestampRulesValidationError{
|
|
field: "Gte",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
case *TimestampRules_GtNow:
|
|
if v == nil {
|
|
err := TimestampRulesValidationError{
|
|
field: "GreaterThan",
|
|
reason: "oneof value cannot be a typed-nil",
|
|
}
|
|
if !all {
|
|
return err
|
|
}
|
|
errors = append(errors, err)
|
|
}
|
|
// no validation rules for GtNow
|
|
default:
|
|
_ = v // ensures v is used
|
|
}
|
|
|
|
if m.Const != nil {
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetConst()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Const",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Const",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetConst()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return TimestampRulesValidationError{
|
|
field: "Const",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.Within != nil {
|
|
|
|
if all {
|
|
switch v := interface{}(m.GetWithin()).(type) {
|
|
case interface{ ValidateAll() error }:
|
|
if err := v.ValidateAll(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Within",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
case interface{ Validate() error }:
|
|
if err := v.Validate(); err != nil {
|
|
errors = append(errors, TimestampRulesValidationError{
|
|
field: "Within",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
})
|
|
}
|
|
}
|
|
} else if v, ok := interface{}(m.GetWithin()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return TimestampRulesValidationError{
|
|
field: "Within",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(errors) > 0 {
|
|
return TimestampRulesMultiError(errors)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// TimestampRulesMultiError is an error wrapping multiple validation errors
|
|
// returned by TimestampRules.ValidateAll() if the designated constraints
|
|
// aren't met.
|
|
type TimestampRulesMultiError []error
|
|
|
|
// Error returns a concatenation of all the error messages it wraps.
|
|
func (m TimestampRulesMultiError) Error() string {
|
|
var msgs []string
|
|
for _, err := range m {
|
|
msgs = append(msgs, err.Error())
|
|
}
|
|
return strings.Join(msgs, "; ")
|
|
}
|
|
|
|
// AllErrors returns a list of validation violation errors.
|
|
func (m TimestampRulesMultiError) AllErrors() []error { return m }
|
|
|
|
// TimestampRulesValidationError is the validation error returned by
|
|
// TimestampRules.Validate if the designated constraints aren't met.
|
|
type TimestampRulesValidationError struct {
|
|
field string
|
|
reason string
|
|
cause error
|
|
key bool
|
|
}
|
|
|
|
// Field function returns field value.
|
|
func (e TimestampRulesValidationError) Field() string { return e.field }
|
|
|
|
// Reason function returns reason value.
|
|
func (e TimestampRulesValidationError) Reason() string { return e.reason }
|
|
|
|
// Cause function returns cause value.
|
|
func (e TimestampRulesValidationError) Cause() error { return e.cause }
|
|
|
|
// Key function returns key value.
|
|
func (e TimestampRulesValidationError) Key() bool { return e.key }
|
|
|
|
// ErrorName returns error name.
|
|
func (e TimestampRulesValidationError) ErrorName() string { return "TimestampRulesValidationError" }
|
|
|
|
// Error satisfies the builtin error interface
|
|
func (e TimestampRulesValidationError) 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 %sTimestampRules.%s: %s%s",
|
|
key,
|
|
e.field,
|
|
e.reason,
|
|
cause)
|
|
}
|
|
|
|
var _ error = TimestampRulesValidationError{}
|
|
|
|
var _ interface {
|
|
Field() string
|
|
Reason() string
|
|
Key() bool
|
|
Cause() error
|
|
ErrorName() string
|
|
} = TimestampRulesValidationError{}
|