/backend/api/resolver/v1/resolver_api.pb.validate.go
https://github.com/lyft/clutch · Go · 551 lines · 370 code · 108 blank · 73 comment · 58 complexity · 33e90cb0cb84d14327416d09bd744d27 MD5 · raw file
- // Code generated by protoc-gen-validate. DO NOT EDIT.
- // source: resolver/v1/resolver_api.proto
- package resolverv1
- import (
- "bytes"
- "errors"
- "fmt"
- "net"
- "net/mail"
- "net/url"
- "regexp"
- "strings"
- "time"
- "unicode/utf8"
- "github.com/golang/protobuf/ptypes"
- )
- // 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)
- _ = ptypes.DynamicAny{}
- )
- // define the regex for a UUID once up-front
- var _resolver_api_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}$")
- // Validate checks the field values on ResolveRequest with the rules defined in
- // the proto definition for this message. If any rules are violated, an error
- // is returned.
- func (m *ResolveRequest) Validate() error {
- if m == nil {
- return nil
- }
- if len(m.GetWant()) < 1 {
- return ResolveRequestValidationError{
- field: "Want",
- reason: "value length must be at least 1 bytes",
- }
- }
- if m.GetHave() == nil {
- return ResolveRequestValidationError{
- field: "Have",
- reason: "value is required",
- }
- }
- if a := m.GetHave(); a != nil {
- }
- // no validation rules for Limit
- return nil
- }
- // ResolveRequestValidationError is the validation error returned by
- // ResolveRequest.Validate if the designated constraints aren't met.
- type ResolveRequestValidationError struct {
- field string
- reason string
- cause error
- key bool
- }
- // Field function returns field value.
- func (e ResolveRequestValidationError) Field() string { return e.field }
- // Reason function returns reason value.
- func (e ResolveRequestValidationError) Reason() string { return e.reason }
- // Cause function returns cause value.
- func (e ResolveRequestValidationError) Cause() error { return e.cause }
- // Key function returns key value.
- func (e ResolveRequestValidationError) Key() bool { return e.key }
- // ErrorName returns error name.
- func (e ResolveRequestValidationError) ErrorName() string { return "ResolveRequestValidationError" }
- // Error satisfies the builtin error interface
- func (e ResolveRequestValidationError) 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 %sResolveRequest.%s: %s%s",
- key,
- e.field,
- e.reason,
- cause)
- }
- var _ error = ResolveRequestValidationError{}
- var _ interface {
- Field() string
- Reason() string
- Key() bool
- Cause() error
- ErrorName() string
- } = ResolveRequestValidationError{}
- // Validate checks the field values on ResolveResponse with the rules defined
- // in the proto definition for this message. If any rules are violated, an
- // error is returned.
- func (m *ResolveResponse) Validate() error {
- if m == nil {
- return nil
- }
- for idx, item := range m.GetResults() {
- _, _ = idx, item
- if v, ok := interface{}(item).(interface{ Validate() error }); ok {
- if err := v.Validate(); err != nil {
- return ResolveResponseValidationError{
- field: fmt.Sprintf("Results[%v]", idx),
- reason: "embedded message failed validation",
- cause: err,
- }
- }
- }
- }
- for idx, item := range m.GetPartialFailures() {
- _, _ = idx, item
- if v, ok := interface{}(item).(interface{ Validate() error }); ok {
- if err := v.Validate(); err != nil {
- return ResolveResponseValidationError{
- field: fmt.Sprintf("PartialFailures[%v]", idx),
- reason: "embedded message failed validation",
- cause: err,
- }
- }
- }
- }
- return nil
- }
- // ResolveResponseValidationError is the validation error returned by
- // ResolveResponse.Validate if the designated constraints aren't met.
- type ResolveResponseValidationError struct {
- field string
- reason string
- cause error
- key bool
- }
- // Field function returns field value.
- func (e ResolveResponseValidationError) Field() string { return e.field }
- // Reason function returns reason value.
- func (e ResolveResponseValidationError) Reason() string { return e.reason }
- // Cause function returns cause value.
- func (e ResolveResponseValidationError) Cause() error { return e.cause }
- // Key function returns key value.
- func (e ResolveResponseValidationError) Key() bool { return e.key }
- // ErrorName returns error name.
- func (e ResolveResponseValidationError) ErrorName() string { return "ResolveResponseValidationError" }
- // Error satisfies the builtin error interface
- func (e ResolveResponseValidationError) 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 %sResolveResponse.%s: %s%s",
- key,
- e.field,
- e.reason,
- cause)
- }
- var _ error = ResolveResponseValidationError{}
- var _ interface {
- Field() string
- Reason() string
- Key() bool
- Cause() error
- ErrorName() string
- } = ResolveResponseValidationError{}
- // Validate checks the field values on SearchRequest with the rules defined in
- // the proto definition for this message. If any rules are violated, an error
- // is returned.
- func (m *SearchRequest) Validate() error {
- if m == nil {
- return nil
- }
- if len(m.GetWant()) < 1 {
- return SearchRequestValidationError{
- field: "Want",
- reason: "value length must be at least 1 bytes",
- }
- }
- if len(m.GetQuery()) < 1 {
- return SearchRequestValidationError{
- field: "Query",
- reason: "value length must be at least 1 bytes",
- }
- }
- // no validation rules for Limit
- return nil
- }
- // SearchRequestValidationError is the validation error returned by
- // SearchRequest.Validate if the designated constraints aren't met.
- type SearchRequestValidationError struct {
- field string
- reason string
- cause error
- key bool
- }
- // Field function returns field value.
- func (e SearchRequestValidationError) Field() string { return e.field }
- // Reason function returns reason value.
- func (e SearchRequestValidationError) Reason() string { return e.reason }
- // Cause function returns cause value.
- func (e SearchRequestValidationError) Cause() error { return e.cause }
- // Key function returns key value.
- func (e SearchRequestValidationError) Key() bool { return e.key }
- // ErrorName returns error name.
- func (e SearchRequestValidationError) ErrorName() string { return "SearchRequestValidationError" }
- // Error satisfies the builtin error interface
- func (e SearchRequestValidationError) 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 %sSearchRequest.%s: %s%s",
- key,
- e.field,
- e.reason,
- cause)
- }
- var _ error = SearchRequestValidationError{}
- var _ interface {
- Field() string
- Reason() string
- Key() bool
- Cause() error
- ErrorName() string
- } = SearchRequestValidationError{}
- // Validate checks the field values on SearchResponse with the rules defined in
- // the proto definition for this message. If any rules are violated, an error
- // is returned.
- func (m *SearchResponse) Validate() error {
- if m == nil {
- return nil
- }
- for idx, item := range m.GetResults() {
- _, _ = idx, item
- if v, ok := interface{}(item).(interface{ Validate() error }); ok {
- if err := v.Validate(); err != nil {
- return SearchResponseValidationError{
- field: fmt.Sprintf("Results[%v]", idx),
- reason: "embedded message failed validation",
- cause: err,
- }
- }
- }
- }
- for idx, item := range m.GetPartialFailures() {
- _, _ = idx, item
- if v, ok := interface{}(item).(interface{ Validate() error }); ok {
- if err := v.Validate(); err != nil {
- return SearchResponseValidationError{
- field: fmt.Sprintf("PartialFailures[%v]", idx),
- reason: "embedded message failed validation",
- cause: err,
- }
- }
- }
- }
- return nil
- }
- // SearchResponseValidationError is the validation error returned by
- // SearchResponse.Validate if the designated constraints aren't met.
- type SearchResponseValidationError struct {
- field string
- reason string
- cause error
- key bool
- }
- // Field function returns field value.
- func (e SearchResponseValidationError) Field() string { return e.field }
- // Reason function returns reason value.
- func (e SearchResponseValidationError) Reason() string { return e.reason }
- // Cause function returns cause value.
- func (e SearchResponseValidationError) Cause() error { return e.cause }
- // Key function returns key value.
- func (e SearchResponseValidationError) Key() bool { return e.key }
- // ErrorName returns error name.
- func (e SearchResponseValidationError) ErrorName() string { return "SearchResponseValidationError" }
- // Error satisfies the builtin error interface
- func (e SearchResponseValidationError) 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 %sSearchResponse.%s: %s%s",
- key,
- e.field,
- e.reason,
- cause)
- }
- var _ error = SearchResponseValidationError{}
- var _ interface {
- Field() string
- Reason() string
- Key() bool
- Cause() error
- ErrorName() string
- } = SearchResponseValidationError{}
- // Validate checks the field values on GetObjectSchemasRequest with the rules
- // defined in the proto definition for this message. If any rules are
- // violated, an error is returned.
- func (m *GetObjectSchemasRequest) Validate() error {
- if m == nil {
- return nil
- }
- if len(m.GetTypeUrl()) < 1 {
- return GetObjectSchemasRequestValidationError{
- field: "TypeUrl",
- reason: "value length must be at least 1 bytes",
- }
- }
- return nil
- }
- // GetObjectSchemasRequestValidationError is the validation error returned by
- // GetObjectSchemasRequest.Validate if the designated constraints aren't met.
- type GetObjectSchemasRequestValidationError struct {
- field string
- reason string
- cause error
- key bool
- }
- // Field function returns field value.
- func (e GetObjectSchemasRequestValidationError) Field() string { return e.field }
- // Reason function returns reason value.
- func (e GetObjectSchemasRequestValidationError) Reason() string { return e.reason }
- // Cause function returns cause value.
- func (e GetObjectSchemasRequestValidationError) Cause() error { return e.cause }
- // Key function returns key value.
- func (e GetObjectSchemasRequestValidationError) Key() bool { return e.key }
- // ErrorName returns error name.
- func (e GetObjectSchemasRequestValidationError) ErrorName() string {
- return "GetObjectSchemasRequestValidationError"
- }
- // Error satisfies the builtin error interface
- func (e GetObjectSchemasRequestValidationError) 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 %sGetObjectSchemasRequest.%s: %s%s",
- key,
- e.field,
- e.reason,
- cause)
- }
- var _ error = GetObjectSchemasRequestValidationError{}
- var _ interface {
- Field() string
- Reason() string
- Key() bool
- Cause() error
- ErrorName() string
- } = GetObjectSchemasRequestValidationError{}
- // Validate checks the field values on GetObjectSchemasResponse with the rules
- // defined in the proto definition for this message. If any rules are
- // violated, an error is returned.
- func (m *GetObjectSchemasResponse) Validate() error {
- if m == nil {
- return nil
- }
- // no validation rules for TypeUrl
- for idx, item := range m.GetSchemas() {
- _, _ = idx, item
- if v, ok := interface{}(item).(interface{ Validate() error }); ok {
- if err := v.Validate(); err != nil {
- return GetObjectSchemasResponseValidationError{
- field: fmt.Sprintf("Schemas[%v]", idx),
- reason: "embedded message failed validation",
- cause: err,
- }
- }
- }
- }
- return nil
- }
- // GetObjectSchemasResponseValidationError is the validation error returned by
- // GetObjectSchemasResponse.Validate if the designated constraints aren't met.
- type GetObjectSchemasResponseValidationError struct {
- field string
- reason string
- cause error
- key bool
- }
- // Field function returns field value.
- func (e GetObjectSchemasResponseValidationError) Field() string { return e.field }
- // Reason function returns reason value.
- func (e GetObjectSchemasResponseValidationError) Reason() string { return e.reason }
- // Cause function returns cause value.
- func (e GetObjectSchemasResponseValidationError) Cause() error { return e.cause }
- // Key function returns key value.
- func (e GetObjectSchemasResponseValidationError) Key() bool { return e.key }
- // ErrorName returns error name.
- func (e GetObjectSchemasResponseValidationError) ErrorName() string {
- return "GetObjectSchemasResponseValidationError"
- }
- // Error satisfies the builtin error interface
- func (e GetObjectSchemasResponseValidationError) 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 %sGetObjectSchemasResponse.%s: %s%s",
- key,
- e.field,
- e.reason,
- cause)
- }
- var _ error = GetObjectSchemasResponseValidationError{}
- var _ interface {
- Field() string
- Reason() string
- Key() bool
- Cause() error
- ErrorName() string
- } = GetObjectSchemasResponseValidationError{}