func (e GatewayTxAcknowledgmentValidationError) 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 %sGatewayTxAcknowledgment.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
Error satisfies the builtin error interface
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 _messages_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 *UplinkMessage) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = UplinkMessageFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "raw_payload":
		case "payload":
			if v, ok := interface{}(m.GetPayload()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return UplinkMessageValidationError{
						field:  "payload",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "settings":
			if v, ok := interface{}(&m.Settings).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return UplinkMessageValidationError{
						field:  "settings",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "rx_metadata":
			for idx, item := range m.GetRxMetadata() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return UplinkMessageValidationError{
							field:  fmt.Sprintf("rx_metadata[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		case "received_at":
			if v, ok := interface{}(&m.ReceivedAt).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return UplinkMessageValidationError{
						field:  "received_at",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "correlation_ids":
			for idx, item := range m.GetCorrelationIds() {
				_, _ = idx, item
				if utf8.RuneCountInString(item) > 100 {
					return UplinkMessageValidationError{
						field:  fmt.Sprintf("correlation_ids[%v]", idx),
						reason: "value length must be at most 100 runes",
					}
				}
			}
		case "device_channel_index":
			if m.GetDeviceChannelIndex() > 255 {
				return UplinkMessageValidationError{
					field:  "device_channel_index",
					reason: "value must be less than or equal to 255",
				}
			}
		case "consumed_airtime":
			if v, ok := interface{}(m.GetConsumedAirtime()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return UplinkMessageValidationError{
						field:  "consumed_airtime",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return UplinkMessageValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type UplinkMessageValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e UplinkMessageValidationError) Field() string { return e.field }
func (e UplinkMessageValidationError) Reason() string { return e.reason }
func (e UplinkMessageValidationError) Cause() error { return e.cause }
func (e UplinkMessageValidationError) Key() bool { return e.key }
func (e UplinkMessageValidationError) ErrorName() string { return "UplinkMessageValidationError" }
func (e UplinkMessageValidationError) 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 %sUplinkMessage.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = UplinkMessageValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = UplinkMessageValidationError{}
func (m *DownlinkMessage) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = DownlinkMessageFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "raw_payload":
		case "payload":
			if v, ok := interface{}(m.GetPayload()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return DownlinkMessageValidationError{
						field:  "payload",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "end_device_ids":
			if v, ok := interface{}(m.GetEndDeviceIds()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return DownlinkMessageValidationError{
						field:  "end_device_ids",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "correlation_ids":
			for idx, item := range m.GetCorrelationIds() {
				_, _ = idx, item
				if utf8.RuneCountInString(item) > 100 {
					return DownlinkMessageValidationError{
						field:  fmt.Sprintf("correlation_ids[%v]", idx),
						reason: "value length must be at most 100 runes",
					}
				}
			}
		case "session_key_id":
			if len(m.GetSessionKeyId()) > 2048 {
				return DownlinkMessageValidationError{
					field:  "session_key_id",
					reason: "value length must be at most 2048 bytes",
				}
			}
		case "settings":
			if m.Settings == nil {
				return DownlinkMessageValidationError{
					field:  "settings",
					reason: "value is required",
				}
			}
			if len(subs) == 0 {
				subs = []string{
					"request", "scheduled",
				}
			}
			for name, subs := range _processPaths(subs) {
				_ = subs
				switch name {
				case "request":
					w, ok := m.Settings.(*DownlinkMessage_Request)
					if !ok || w == nil {
						continue
					}
					if v, ok := interface{}(m.GetRequest()).(interface{ ValidateFields(...string) error }); ok {
						if err := v.ValidateFields(subs...); err != nil {
							return DownlinkMessageValidationError{
								field:  "request",
								reason: "embedded message failed validation",
								cause:  err,
							}
						}
					}
				case "scheduled":
					w, ok := m.Settings.(*DownlinkMessage_Scheduled)
					if !ok || w == nil {
						continue
					}
					if v, ok := interface{}(m.GetScheduled()).(interface{ ValidateFields(...string) error }); ok {
						if err := v.ValidateFields(subs...); err != nil {
							return DownlinkMessageValidationError{
								field:  "scheduled",
								reason: "embedded message failed validation",
								cause:  err,
							}
						}
					}
				}
			}
		default:
			return DownlinkMessageValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type DownlinkMessageValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e DownlinkMessageValidationError) Field() string { return e.field }
func (e DownlinkMessageValidationError) Reason() string { return e.reason }
func (e DownlinkMessageValidationError) Cause() error { return e.cause }
func (e DownlinkMessageValidationError) Key() bool { return e.key }
func (e DownlinkMessageValidationError) ErrorName() string { return "DownlinkMessageValidationError" }
func (e DownlinkMessageValidationError) 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 %sDownlinkMessage.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = DownlinkMessageValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = DownlinkMessageValidationError{}
func (m *TxAcknowledgment) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = TxAcknowledgmentFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "correlation_ids":
			for idx, item := range m.GetCorrelationIds() {
				_, _ = idx, item
				if utf8.RuneCountInString(item) > 100 {
					return TxAcknowledgmentValidationError{
						field:  fmt.Sprintf("correlation_ids[%v]", idx),
						reason: "value length must be at most 100 runes",
					}
				}
			}
		case "result":
			if _, ok := TxAcknowledgment_Result_name[int32(m.GetResult())]; !ok {
				return TxAcknowledgmentValidationError{
					field:  "result",
					reason: "value must be one of the defined enum values",
				}
			}
		case "downlink_message":
			if v, ok := interface{}(m.GetDownlinkMessage()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return TxAcknowledgmentValidationError{
						field:  "downlink_message",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return TxAcknowledgmentValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type TxAcknowledgmentValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e TxAcknowledgmentValidationError) Field() string { return e.field }
func (e TxAcknowledgmentValidationError) Reason() string { return e.reason }
func (e TxAcknowledgmentValidationError) Cause() error { return e.cause }
func (e TxAcknowledgmentValidationError) Key() bool { return e.key }
func (e TxAcknowledgmentValidationError) ErrorName() string { return "TxAcknowledgmentValidationError" }
func (e TxAcknowledgmentValidationError) 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 %sTxAcknowledgment.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = TxAcknowledgmentValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = TxAcknowledgmentValidationError{}
func (m *GatewayTxAcknowledgment) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = GatewayTxAcknowledgmentFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "gateway_ids":
			if v, ok := interface{}(m.GetGatewayIds()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return GatewayTxAcknowledgmentValidationError{
						field:  "gateway_ids",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "tx_ack":
			if v, ok := interface{}(m.GetTxAck()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return GatewayTxAcknowledgmentValidationError{
						field:  "tx_ack",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return GatewayTxAcknowledgmentValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type GatewayTxAcknowledgmentValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e GatewayTxAcknowledgmentValidationError) Field() string { return e.field }
func (e GatewayTxAcknowledgmentValidationError) Reason() string { return e.reason }
func (e GatewayTxAcknowledgmentValidationError) Cause() error { return e.cause }
func (e GatewayTxAcknowledgmentValidationError) Key() bool { return e.key }
func (e GatewayTxAcknowledgmentValidationError) ErrorName() string {
	return "GatewayTxAcknowledgmentValidationError"
}