func (e ApplicationPubSubFormatsValidationError) 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 %sApplicationPubSubFormats.%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 _applicationserver_pubsub_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 *ApplicationPubSubIdentifiers) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = ApplicationPubSubIdentifiersFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "application_ids":
			if m.GetApplicationIds() == nil {
				return ApplicationPubSubIdentifiersValidationError{
					field:  "application_ids",
					reason: "value is required",
				}
			}
			if v, ok := interface{}(m.GetApplicationIds()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubIdentifiersValidationError{
						field:  "application_ids",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "pub_sub_id":
			if utf8.RuneCountInString(m.GetPubSubId()) > 36 {
				return ApplicationPubSubIdentifiersValidationError{
					field:  "pub_sub_id",
					reason: "value length must be at most 36 runes",
				}
			}
			if !_ApplicationPubSubIdentifiers_PubSubId_Pattern.MatchString(m.GetPubSubId()) {
				return ApplicationPubSubIdentifiersValidationError{
					field:  "pub_sub_id",
					reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"",
				}
			}
		default:
			return ApplicationPubSubIdentifiersValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type ApplicationPubSubIdentifiersValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e ApplicationPubSubIdentifiersValidationError) Field() string { return e.field }
func (e ApplicationPubSubIdentifiersValidationError) Reason() string { return e.reason }
func (e ApplicationPubSubIdentifiersValidationError) Cause() error { return e.cause }
func (e ApplicationPubSubIdentifiersValidationError) Key() bool { return e.key }
func (e ApplicationPubSubIdentifiersValidationError) ErrorName() string {
	return "ApplicationPubSubIdentifiersValidationError"
}
func (e ApplicationPubSubIdentifiersValidationError) 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 %sApplicationPubSubIdentifiers.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = ApplicationPubSubIdentifiersValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ApplicationPubSubIdentifiersValidationError{}
var _ApplicationPubSubIdentifiers_PubSubId_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$")
func (m *ApplicationPubSub) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = ApplicationPubSubFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "ids":
			if m.GetIds() == nil {
				return ApplicationPubSubValidationError{
					field:  "ids",
					reason: "value is required",
				}
			}
			if v, ok := interface{}(m.GetIds()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "ids",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "created_at":
			if v, ok := interface{}(m.GetCreatedAt()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "created_at",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "updated_at":
			if v, ok := interface{}(m.GetUpdatedAt()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "updated_at",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "format":
			if utf8.RuneCountInString(m.GetFormat()) > 20 {
				return ApplicationPubSubValidationError{
					field:  "format",
					reason: "value length must be at most 20 runes",
				}
			}
			if !_ApplicationPubSub_Format_Pattern.MatchString(m.GetFormat()) {
				return ApplicationPubSubValidationError{
					field:  "format",
					reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"",
				}
			}
		case "base_topic":
			if utf8.RuneCountInString(m.GetBaseTopic()) > 100 {
				return ApplicationPubSubValidationError{
					field:  "base_topic",
					reason: "value length must be at most 100 runes",
				}
			}
		case "downlink_push":
			if v, ok := interface{}(m.GetDownlinkPush()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "downlink_push",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "downlink_replace":
			if v, ok := interface{}(m.GetDownlinkReplace()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "downlink_replace",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "uplink_message":
			if v, ok := interface{}(m.GetUplinkMessage()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "uplink_message",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "join_accept":
			if v, ok := interface{}(m.GetJoinAccept()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "join_accept",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "downlink_ack":
			if v, ok := interface{}(m.GetDownlinkAck()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "downlink_ack",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "downlink_nack":
			if v, ok := interface{}(m.GetDownlinkNack()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "downlink_nack",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "downlink_sent":
			if v, ok := interface{}(m.GetDownlinkSent()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "downlink_sent",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "downlink_failed":
			if v, ok := interface{}(m.GetDownlinkFailed()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "downlink_failed",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "downlink_queued":
			if v, ok := interface{}(m.GetDownlinkQueued()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "downlink_queued",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "downlink_queue_invalidated":
			if v, ok := interface{}(m.GetDownlinkQueueInvalidated()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "downlink_queue_invalidated",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "location_solved":
			if v, ok := interface{}(m.GetLocationSolved()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "location_solved",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "service_data":
			if v, ok := interface{}(m.GetServiceData()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ApplicationPubSubValidationError{
						field:  "service_data",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "provider":
			if m.Provider == nil {
				return ApplicationPubSubValidationError{
					field:  "provider",
					reason: "value is required",
				}
			}
			if len(subs) == 0 {
				subs = []string{
					"nats", "mqtt", "aws_iot",
				}
			}
			for name, subs := range _processPaths(subs) {
				_ = subs
				switch name {
				case "nats":
					w, ok := m.Provider.(*ApplicationPubSub_Nats)
					if !ok || w == nil {
						continue
					}
					if v, ok := interface{}(m.GetNats()).(interface{ ValidateFields(...string) error }); ok {
						if err := v.ValidateFields(subs...); err != nil {
							return ApplicationPubSubValidationError{
								field:  "nats",
								reason: "embedded message failed validation",
								cause:  err,
							}
						}
					}
				case "mqtt":
					w, ok := m.Provider.(*ApplicationPubSub_Mqtt)
					if !ok || w == nil {
						continue
					}
					if v, ok := interface{}(m.GetMqtt()).(interface{ ValidateFields(...string) error }); ok {
						if err := v.ValidateFields(subs...); err != nil {
							return ApplicationPubSubValidationError{
								field:  "mqtt",
								reason: "embedded message failed validation",
								cause:  err,
							}
						}
					}
				case "aws_iot":
					w, ok := m.Provider.(*ApplicationPubSub_AwsIot)
					if !ok || w == nil {
						continue
					}
					if v, ok := interface{}(m.GetAwsIot()).(interface{ ValidateFields(...string) error }); ok {
						if err := v.ValidateFields(subs...); err != nil {
							return ApplicationPubSubValidationError{
								field:  "aws_iot",
								reason: "embedded message failed validation",
								cause:  err,
							}
						}
					}
				}
			}
		default:
			return ApplicationPubSubValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type ApplicationPubSubValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e ApplicationPubSubValidationError) Field() string { return e.field }
func (e ApplicationPubSubValidationError) Reason() string { return e.reason }
func (e ApplicationPubSubValidationError) Cause() error { return e.cause }
func (e ApplicationPubSubValidationError) Key() bool { return e.key }
func (e ApplicationPubSubValidationError) ErrorName() string {
	return "ApplicationPubSubValidationError"
}
func (e ApplicationPubSubValidationError) 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 %sApplicationPubSub.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = ApplicationPubSubValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ApplicationPubSubValidationError{}
var _ApplicationPubSub_Format_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$")
func (m *ApplicationPubSubs) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = ApplicationPubSubsFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "pubsubs":
			for idx, item := range m.GetPubsubs() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return ApplicationPubSubsValidationError{
							field:  fmt.Sprintf("pubsubs[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		default:
			return ApplicationPubSubsValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type ApplicationPubSubsValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e ApplicationPubSubsValidationError) Field() string { return e.field }
func (e ApplicationPubSubsValidationError) Reason() string { return e.reason }
func (e ApplicationPubSubsValidationError) Cause() error { return e.cause }
func (e ApplicationPubSubsValidationError) Key() bool { return e.key }
func (e ApplicationPubSubsValidationError) ErrorName() string {
	return "ApplicationPubSubsValidationError"
}
func (e ApplicationPubSubsValidationError) 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 %sApplicationPubSubs.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = ApplicationPubSubsValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ApplicationPubSubsValidationError{}
func (m *ApplicationPubSubFormats) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = ApplicationPubSubFormatsFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "formats":
		default:
			return ApplicationPubSubFormatsValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type ApplicationPubSubFormatsValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e ApplicationPubSubFormatsValidationError) Field() string { return e.field }
func (e ApplicationPubSubFormatsValidationError) Reason() string { return e.reason }
func (e ApplicationPubSubFormatsValidationError) Cause() error { return e.cause }
func (e ApplicationPubSubFormatsValidationError) Key() bool { return e.key }
func (e ApplicationPubSubFormatsValidationError) ErrorName() string {
	return "ApplicationPubSubFormatsValidationError"
}