func (m *EndDeviceVersion) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = EndDeviceVersionFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "ids":
			if v, ok := interface{}(&m.EndDeviceVersionIdentifiers).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceVersionValidationError{
						field:  "ids",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "lorawan_version":
			if _, ok := MACVersion_name[int32(m.GetLorawanVersion())]; !ok {
				return EndDeviceVersionValidationError{
					field:  "lorawan_version",
					reason: "value must be one of the defined enum values",
				}
			}
		case "lorawan_phy_version":
			if _, ok := PHYVersion_name[int32(m.GetLorawanPhyVersion())]; !ok {
				return EndDeviceVersionValidationError{
					field:  "lorawan_phy_version",
					reason: "value must be one of the defined enum values",
				}
			}
		case "frequency_plan_id":
			if utf8.RuneCountInString(m.GetFrequencyPlanId()) > 64 {
				return EndDeviceVersionValidationError{
					field:  "frequency_plan_id",
					reason: "value length must be at most 64 runes",
				}
			}
		case "photos":
			if len(m.GetPhotos()) > 10 {
				return EndDeviceVersionValidationError{
					field:  "photos",
					reason: "value must contain no more than 10 item(s)",
				}
			}
		case "supports_class_b":
		case "supports_class_c":
		case "default_mac_settings":
			if v, ok := interface{}(m.GetDefaultMacSettings()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceVersionValidationError{
						field:  "default_mac_settings",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "min_frequency":
		case "max_frequency":
		case "supports_join":
		case "resets_join_nonces":
		case "default_formatters":
			if v, ok := interface{}(&m.DefaultFormatters).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceVersionValidationError{
						field:  "default_formatters",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return EndDeviceVersionValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
ValidateFields checks the field values on EndDeviceVersion with the rules
defined in the proto definition for this message. If any rules are
violated, an error is returned.
package ttnpb
import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"strings"
	"time"
	"unicode/utf8"
	"github.com/gogo/protobuf/types"
)
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)
	_ = types.DynamicAny{}
)
var _end_device_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
func (m *Session) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = SessionFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "dev_addr":
		case "keys":
			if v, ok := interface{}(&m.SessionKeys).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return SessionValidationError{
						field:  "keys",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "last_f_cnt_up":
		case "last_n_f_cnt_down":
		case "last_a_f_cnt_down":
		case "last_conf_f_cnt_down":
		case "started_at":
			if v, ok := interface{}(&m.StartedAt).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return SessionValidationError{
						field:  "started_at",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "queued_application_downlinks":
			for idx, item := range m.GetQueuedApplicationDownlinks() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return SessionValidationError{
							field:  fmt.Sprintf("queued_application_downlinks[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		default:
			return SessionValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type SessionValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e SessionValidationError) Field() string { return e.field }
func (e SessionValidationError) Reason() string { return e.reason }
func (e SessionValidationError) Cause() error { return e.cause }
func (e SessionValidationError) Key() bool { return e.key }
func (e SessionValidationError) ErrorName() string { return "SessionValidationError" }
func (e SessionValidationError) 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 %sSession.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = SessionValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = SessionValidationError{}
func (m *BoolValue) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = BoolValueFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "value":
		default:
			return BoolValueValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type BoolValueValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e BoolValueValidationError) Field() string { return e.field }
func (e BoolValueValidationError) Reason() string { return e.reason }
func (e BoolValueValidationError) Cause() error { return e.cause }
func (e BoolValueValidationError) Key() bool { return e.key }
func (e BoolValueValidationError) ErrorName() string { return "BoolValueValidationError" }
func (e BoolValueValidationError) 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 %sBoolValue.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = BoolValueValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = BoolValueValidationError{}
func (m *MACParameters) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = MACParametersFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "max_eirp":
		case "adr_data_rate_index":
			if _, ok := DataRateIndex_name[int32(m.GetAdrDataRateIndex())]; !ok {
				return MACParametersValidationError{
					field:  "adr_data_rate_index",
					reason: "value must be one of the defined enum values",
				}
			}
		case "adr_tx_power_index":
			if m.GetAdrTxPowerIndex() > 15 {
				return MACParametersValidationError{
					field:  "adr_tx_power_index",
					reason: "value must be less than or equal to 15",
				}
			}
		case "adr_nb_trans":
			if m.GetAdrNbTrans() > 15 {
				return MACParametersValidationError{
					field:  "adr_nb_trans",
					reason: "value must be less than or equal to 15",
				}
			}
		case "adr_ack_limit":
		case "adr_ack_delay":
		case "rx1_delay":
			if _, ok := RxDelay_name[int32(m.GetRx1Delay())]; !ok {
				return MACParametersValidationError{
					field:  "rx1_delay",
					reason: "value must be one of the defined enum values",
				}
			}
		case "rx1_data_rate_offset":
			if _, ok := DataRateOffset_name[int32(m.GetRx1DataRateOffset())]; !ok {
				return MACParametersValidationError{
					field:  "rx1_data_rate_offset",
					reason: "value must be one of the defined enum values",
				}
			}
		case "rx2_data_rate_index":
			if _, ok := DataRateIndex_name[int32(m.GetRx2DataRateIndex())]; !ok {
				return MACParametersValidationError{
					field:  "rx2_data_rate_index",
					reason: "value must be one of the defined enum values",
				}
			}
		case "rx2_frequency":
			if m.GetRx2Frequency() < 100000 {
				return MACParametersValidationError{
					field:  "rx2_frequency",
					reason: "value must be greater than or equal to 100000",
				}
			}
		case "max_duty_cycle":
			if _, ok := AggregatedDutyCycle_name[int32(m.GetMaxDutyCycle())]; !ok {
				return MACParametersValidationError{
					field:  "max_duty_cycle",
					reason: "value must be one of the defined enum values",
				}
			}
		case "rejoin_time_periodicity":
			if _, ok := RejoinTimeExponent_name[int32(m.GetRejoinTimePeriodicity())]; !ok {
				return MACParametersValidationError{
					field:  "rejoin_time_periodicity",
					reason: "value must be one of the defined enum values",
				}
			}
		case "rejoin_count_periodicity":
			if _, ok := RejoinCountExponent_name[int32(m.GetRejoinCountPeriodicity())]; !ok {
				return MACParametersValidationError{
					field:  "rejoin_count_periodicity",
					reason: "value must be one of the defined enum values",
				}
			}
		case "ping_slot_frequency":
			if val := m.GetPingSlotFrequency(); val > 0 && val < 100000 {
				return MACParametersValidationError{
					field:  "ping_slot_frequency",
					reason: "value must be outside range (0, 100000)",
				}
			}
		case "ping_slot_data_rate_index":
		case "beacon_frequency":
			if val := m.GetBeaconFrequency(); val > 0 && val < 100000 {
				return MACParametersValidationError{
					field:  "beacon_frequency",
					reason: "value must be outside range (0, 100000)",
				}
			}
		case "channels":
			if len(m.GetChannels()) < 1 {
				return MACParametersValidationError{
					field:  "channels",
					reason: "value must contain at least 1 item(s)",
				}
			}
			for idx, item := range m.GetChannels() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return MACParametersValidationError{
							field:  fmt.Sprintf("channels[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		case "uplink_dwell_time":
			if v, ok := interface{}(m.GetUplinkDwellTime()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return MACParametersValidationError{
						field:  "uplink_dwell_time",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "downlink_dwell_time":
			if v, ok := interface{}(m.GetDownlinkDwellTime()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return MACParametersValidationError{
						field:  "downlink_dwell_time",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "adr_ack_limit_exponent":
			if v, ok := interface{}(m.GetAdrAckLimitExponent()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return MACParametersValidationError{
						field:  "adr_ack_limit_exponent",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "adr_ack_delay_exponent":
			if v, ok := interface{}(m.GetAdrAckDelayExponent()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return MACParametersValidationError{
						field:  "adr_ack_delay_exponent",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "ping_slot_data_rate_index_value":
			if v, ok := interface{}(m.GetPingSlotDataRateIndexValue()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return MACParametersValidationError{
						field:  "ping_slot_data_rate_index_value",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return MACParametersValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type MACParametersValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e MACParametersValidationError) Field() string { return e.field }
func (e MACParametersValidationError) Reason() string { return e.reason }
func (e MACParametersValidationError) Cause() error { return e.cause }
func (e MACParametersValidationError) Key() bool { return e.key }
func (e MACParametersValidationError) ErrorName() string { return "MACParametersValidationError" }
func (e MACParametersValidationError) 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 %sMACParameters.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = MACParametersValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = MACParametersValidationError{}