Documentation ¶
Index ¶
- Variables
- type AnyRules
- type BoolRules
- type BytesRules
- func (*BytesRules) Descriptor() ([]byte, []int)deprecated
- func (x *BytesRules) GetConst() []byte
- func (x *BytesRules) GetContains() []byte
- func (x *BytesRules) GetIn() [][]byte
- func (x *BytesRules) GetIp() bool
- func (x *BytesRules) GetIpv4() bool
- func (x *BytesRules) GetIpv6() bool
- func (x *BytesRules) GetLen() uint64
- func (x *BytesRules) GetMaxLen() uint64
- func (x *BytesRules) GetMinLen() uint64
- func (x *BytesRules) GetNotIn() [][]byte
- func (x *BytesRules) GetPattern() string
- func (x *BytesRules) GetPrefix() []byte
- func (x *BytesRules) GetSuffix() []byte
- func (m *BytesRules) GetWellKnown() isBytesRules_WellKnown
- func (*BytesRules) ProtoMessage()
- func (x *BytesRules) ProtoReflect() protoreflect.Message
- func (x *BytesRules) Reset()
- func (x *BytesRules) String() string
- type BytesRules_Ip
- type BytesRules_Ipv4
- type BytesRules_Ipv6
- type Constraint
- func (*Constraint) Descriptor() ([]byte, []int)deprecated
- func (x *Constraint) GetExpression() string
- func (x *Constraint) GetId() string
- func (x *Constraint) GetMessage() string
- func (*Constraint) ProtoMessage()
- func (x *Constraint) ProtoReflect() protoreflect.Message
- func (x *Constraint) Reset()
- func (x *Constraint) String() string
- type DoubleRules
- func (*DoubleRules) Descriptor() ([]byte, []int)deprecated
- func (x *DoubleRules) GetConst() float64
- func (x *DoubleRules) GetGt() float64
- func (x *DoubleRules) GetGte() float64
- func (x *DoubleRules) GetIn() []float64
- func (x *DoubleRules) GetLt() float64
- func (x *DoubleRules) GetLte() float64
- func (x *DoubleRules) GetNotIn() []float64
- func (*DoubleRules) ProtoMessage()
- func (x *DoubleRules) ProtoReflect() protoreflect.Message
- func (x *DoubleRules) Reset()
- func (x *DoubleRules) String() string
- type DurationRules
- func (*DurationRules) Descriptor() ([]byte, []int)deprecated
- func (x *DurationRules) GetConst() *durationpb.Duration
- func (x *DurationRules) GetGt() *durationpb.Duration
- func (x *DurationRules) GetGte() *durationpb.Duration
- func (x *DurationRules) GetIn() []*durationpb.Duration
- func (x *DurationRules) GetLt() *durationpb.Duration
- func (x *DurationRules) GetLte() *durationpb.Duration
- func (x *DurationRules) GetNotIn() []*durationpb.Duration
- func (*DurationRules) ProtoMessage()
- func (x *DurationRules) ProtoReflect() protoreflect.Message
- func (x *DurationRules) Reset()
- func (x *DurationRules) String() string
- type EnumRules
- func (*EnumRules) Descriptor() ([]byte, []int)deprecated
- func (x *EnumRules) GetConst() int32
- func (x *EnumRules) GetDefinedOnly() bool
- func (x *EnumRules) GetIn() []int32
- func (x *EnumRules) GetNotIn() []int32
- func (*EnumRules) ProtoMessage()
- func (x *EnumRules) ProtoReflect() protoreflect.Message
- func (x *EnumRules) Reset()
- func (x *EnumRules) String() string
- type FieldConstraints
- func (*FieldConstraints) Descriptor() ([]byte, []int)deprecated
- func (x *FieldConstraints) GetAny() *AnyRules
- func (x *FieldConstraints) GetBool() *BoolRules
- func (x *FieldConstraints) GetBytes() *BytesRules
- func (x *FieldConstraints) GetCel() []*Constraint
- func (x *FieldConstraints) GetDouble() *DoubleRules
- func (x *FieldConstraints) GetDuration() *DurationRules
- func (x *FieldConstraints) GetEnum() *EnumRules
- func (x *FieldConstraints) GetFixed32() *Fixed32Rules
- func (x *FieldConstraints) GetFixed64() *Fixed64Rules
- func (x *FieldConstraints) GetFloat() *FloatRules
- func (x *FieldConstraints) GetIgnoreEmpty() bool
- func (x *FieldConstraints) GetInt32() *Int32Rules
- func (x *FieldConstraints) GetInt64() *Int64Rules
- func (x *FieldConstraints) GetMap() *MapRules
- func (x *FieldConstraints) GetRepeated() *RepeatedRules
- func (x *FieldConstraints) GetRequired() bool
- func (x *FieldConstraints) GetSfixed32() *SFixed32Rules
- func (x *FieldConstraints) GetSfixed64() *SFixed64Rules
- func (x *FieldConstraints) GetSint32() *SInt32Rules
- func (x *FieldConstraints) GetSint64() *SInt64Rules
- func (x *FieldConstraints) GetSkipped() bool
- func (x *FieldConstraints) GetString_() *StringRules
- func (x *FieldConstraints) GetTimestamp() *TimestampRules
- func (m *FieldConstraints) GetType() isFieldConstraints_Type
- func (x *FieldConstraints) GetUint32() *UInt32Rules
- func (x *FieldConstraints) GetUint64() *UInt64Rules
- func (*FieldConstraints) ProtoMessage()
- func (x *FieldConstraints) ProtoReflect() protoreflect.Message
- func (x *FieldConstraints) Reset()
- func (x *FieldConstraints) String() string
- type FieldConstraints_Any
- type FieldConstraints_Bool
- type FieldConstraints_Bytes
- type FieldConstraints_Double
- type FieldConstraints_Duration
- type FieldConstraints_Enum
- type FieldConstraints_Fixed32
- type FieldConstraints_Fixed64
- type FieldConstraints_Float
- type FieldConstraints_Int32
- type FieldConstraints_Int64
- type FieldConstraints_Map
- type FieldConstraints_Repeated
- type FieldConstraints_Sfixed32
- type FieldConstraints_Sfixed64
- type FieldConstraints_Sint32
- type FieldConstraints_Sint64
- type FieldConstraints_String_
- type FieldConstraints_Timestamp
- type FieldConstraints_Uint32
- type FieldConstraints_Uint64
- type Fixed32Rules
- func (*Fixed32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *Fixed32Rules) GetConst() uint32
- func (x *Fixed32Rules) GetGt() uint32
- func (x *Fixed32Rules) GetGte() uint32
- func (x *Fixed32Rules) GetIn() []uint32
- func (x *Fixed32Rules) GetLt() uint32
- func (x *Fixed32Rules) GetLte() uint32
- func (x *Fixed32Rules) GetNotIn() []uint32
- func (*Fixed32Rules) ProtoMessage()
- func (x *Fixed32Rules) ProtoReflect() protoreflect.Message
- func (x *Fixed32Rules) Reset()
- func (x *Fixed32Rules) String() string
- type Fixed64Rules
- func (*Fixed64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *Fixed64Rules) GetConst() uint64
- func (x *Fixed64Rules) GetGt() uint64
- func (x *Fixed64Rules) GetGte() uint64
- func (x *Fixed64Rules) GetIn() []uint64
- func (x *Fixed64Rules) GetLt() uint64
- func (x *Fixed64Rules) GetLte() uint64
- func (x *Fixed64Rules) GetNotIn() []uint64
- func (*Fixed64Rules) ProtoMessage()
- func (x *Fixed64Rules) ProtoReflect() protoreflect.Message
- func (x *Fixed64Rules) Reset()
- func (x *Fixed64Rules) String() string
- type FloatRules
- func (*FloatRules) Descriptor() ([]byte, []int)deprecated
- func (x *FloatRules) GetConst() float32
- func (x *FloatRules) GetGt() float32
- func (x *FloatRules) GetGte() float32
- func (x *FloatRules) GetIn() []float32
- func (x *FloatRules) GetLt() float32
- func (x *FloatRules) GetLte() float32
- func (x *FloatRules) GetNotIn() []float32
- func (*FloatRules) ProtoMessage()
- func (x *FloatRules) ProtoReflect() protoreflect.Message
- func (x *FloatRules) Reset()
- func (x *FloatRules) String() string
- type Int32Rules
- func (*Int32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *Int32Rules) GetConst() int32
- func (x *Int32Rules) GetGt() int32
- func (x *Int32Rules) GetGte() int32
- func (x *Int32Rules) GetIn() []int32
- func (x *Int32Rules) GetLt() int32
- func (x *Int32Rules) GetLte() int32
- func (x *Int32Rules) GetNotIn() []int32
- func (*Int32Rules) ProtoMessage()
- func (x *Int32Rules) ProtoReflect() protoreflect.Message
- func (x *Int32Rules) Reset()
- func (x *Int32Rules) String() string
- type Int64Rules
- func (*Int64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *Int64Rules) GetConst() int64
- func (x *Int64Rules) GetGt() int64
- func (x *Int64Rules) GetGte() int64
- func (x *Int64Rules) GetIn() []int64
- func (x *Int64Rules) GetLt() int64
- func (x *Int64Rules) GetLte() int64
- func (x *Int64Rules) GetNotIn() []int64
- func (*Int64Rules) ProtoMessage()
- func (x *Int64Rules) ProtoReflect() protoreflect.Message
- func (x *Int64Rules) Reset()
- func (x *Int64Rules) String() string
- type KnownRegex
- type MapRules
- func (*MapRules) Descriptor() ([]byte, []int)deprecated
- func (x *MapRules) GetKeys() *FieldConstraints
- func (x *MapRules) GetMaxPairs() uint64
- func (x *MapRules) GetMinPairs() uint64
- func (x *MapRules) GetValues() *FieldConstraints
- func (*MapRules) ProtoMessage()
- func (x *MapRules) ProtoReflect() protoreflect.Message
- func (x *MapRules) Reset()
- func (x *MapRules) String() string
- type MessageConstraints
- func (*MessageConstraints) Descriptor() ([]byte, []int)deprecated
- func (x *MessageConstraints) GetCel() []*Constraint
- func (x *MessageConstraints) GetDisabled() bool
- func (*MessageConstraints) ProtoMessage()
- func (x *MessageConstraints) ProtoReflect() protoreflect.Message
- func (x *MessageConstraints) Reset()
- func (x *MessageConstraints) String() string
- type OneofConstraints
- type RepeatedRules
- func (*RepeatedRules) Descriptor() ([]byte, []int)deprecated
- func (x *RepeatedRules) GetItems() *FieldConstraints
- func (x *RepeatedRules) GetMaxItems() uint64
- func (x *RepeatedRules) GetMinItems() uint64
- func (x *RepeatedRules) GetUnique() bool
- func (*RepeatedRules) ProtoMessage()
- func (x *RepeatedRules) ProtoReflect() protoreflect.Message
- func (x *RepeatedRules) Reset()
- func (x *RepeatedRules) String() string
- type SFixed32Rules
- func (*SFixed32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *SFixed32Rules) GetConst() int32
- func (x *SFixed32Rules) GetGt() int32
- func (x *SFixed32Rules) GetGte() int32
- func (x *SFixed32Rules) GetIn() []int32
- func (x *SFixed32Rules) GetLt() int32
- func (x *SFixed32Rules) GetLte() int32
- func (x *SFixed32Rules) GetNotIn() []int32
- func (*SFixed32Rules) ProtoMessage()
- func (x *SFixed32Rules) ProtoReflect() protoreflect.Message
- func (x *SFixed32Rules) Reset()
- func (x *SFixed32Rules) String() string
- type SFixed64Rules
- func (*SFixed64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *SFixed64Rules) GetConst() int64
- func (x *SFixed64Rules) GetGt() int64
- func (x *SFixed64Rules) GetGte() int64
- func (x *SFixed64Rules) GetIn() []int64
- func (x *SFixed64Rules) GetLt() int64
- func (x *SFixed64Rules) GetLte() int64
- func (x *SFixed64Rules) GetNotIn() []int64
- func (*SFixed64Rules) ProtoMessage()
- func (x *SFixed64Rules) ProtoReflect() protoreflect.Message
- func (x *SFixed64Rules) Reset()
- func (x *SFixed64Rules) String() string
- type SInt32Rules
- func (*SInt32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *SInt32Rules) GetConst() int32
- func (x *SInt32Rules) GetGt() int32
- func (x *SInt32Rules) GetGte() int32
- func (x *SInt32Rules) GetIn() []int32
- func (x *SInt32Rules) GetLt() int32
- func (x *SInt32Rules) GetLte() int32
- func (x *SInt32Rules) GetNotIn() []int32
- func (*SInt32Rules) ProtoMessage()
- func (x *SInt32Rules) ProtoReflect() protoreflect.Message
- func (x *SInt32Rules) Reset()
- func (x *SInt32Rules) String() string
- type SInt64Rules
- func (*SInt64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *SInt64Rules) GetConst() int64
- func (x *SInt64Rules) GetGt() int64
- func (x *SInt64Rules) GetGte() int64
- func (x *SInt64Rules) GetIn() []int64
- func (x *SInt64Rules) GetLt() int64
- func (x *SInt64Rules) GetLte() int64
- func (x *SInt64Rules) GetNotIn() []int64
- func (*SInt64Rules) ProtoMessage()
- func (x *SInt64Rules) ProtoReflect() protoreflect.Message
- func (x *SInt64Rules) Reset()
- func (x *SInt64Rules) String() string
- type StringRules
- func (*StringRules) Descriptor() ([]byte, []int)deprecated
- func (x *StringRules) GetAddress() bool
- func (x *StringRules) GetConst() string
- func (x *StringRules) GetContains() string
- func (x *StringRules) GetEmail() bool
- func (x *StringRules) GetHostname() bool
- func (x *StringRules) GetIn() []string
- func (x *StringRules) GetIp() bool
- func (x *StringRules) GetIpv4() bool
- func (x *StringRules) GetIpv6() bool
- func (x *StringRules) GetLen() uint64
- func (x *StringRules) GetLenBytes() uint64
- func (x *StringRules) GetMaxBytes() uint64
- func (x *StringRules) GetMaxLen() uint64
- func (x *StringRules) GetMinBytes() uint64
- func (x *StringRules) GetMinLen() uint64
- func (x *StringRules) GetNotContains() string
- func (x *StringRules) GetNotIn() []string
- func (x *StringRules) GetPattern() string
- func (x *StringRules) GetPrefix() string
- func (x *StringRules) GetStrict() bool
- func (x *StringRules) GetSuffix() string
- func (x *StringRules) GetUri() bool
- func (x *StringRules) GetUriRef() bool
- func (x *StringRules) GetUuid() bool
- func (m *StringRules) GetWellKnown() isStringRules_WellKnown
- func (x *StringRules) GetWellKnownRegex() KnownRegex
- func (*StringRules) ProtoMessage()
- func (x *StringRules) ProtoReflect() protoreflect.Message
- func (x *StringRules) Reset()
- func (x *StringRules) String() string
- type StringRules_Address
- type StringRules_Email
- type StringRules_Hostname
- type StringRules_Ip
- type StringRules_Ipv4
- type StringRules_Ipv6
- type StringRules_Uri
- type StringRules_UriRef
- type StringRules_Uuid
- type StringRules_WellKnownRegex
- type TimestampRules
- func (*TimestampRules) Descriptor() ([]byte, []int)deprecated
- func (x *TimestampRules) GetConst() *timestamppb.Timestamp
- func (x *TimestampRules) GetGt() *timestamppb.Timestamp
- func (x *TimestampRules) GetGtNow() bool
- func (x *TimestampRules) GetGte() *timestamppb.Timestamp
- func (x *TimestampRules) GetLt() *timestamppb.Timestamp
- func (x *TimestampRules) GetLtNow() bool
- func (x *TimestampRules) GetLte() *timestamppb.Timestamp
- func (x *TimestampRules) GetWithin() *durationpb.Duration
- func (*TimestampRules) ProtoMessage()
- func (x *TimestampRules) ProtoReflect() protoreflect.Message
- func (x *TimestampRules) Reset()
- func (x *TimestampRules) String() string
- type UInt32Rules
- func (*UInt32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *UInt32Rules) GetConst() uint32
- func (x *UInt32Rules) GetGt() uint32
- func (x *UInt32Rules) GetGte() uint32
- func (x *UInt32Rules) GetIn() []uint32
- func (x *UInt32Rules) GetLt() uint32
- func (x *UInt32Rules) GetLte() uint32
- func (x *UInt32Rules) GetNotIn() []uint32
- func (*UInt32Rules) ProtoMessage()
- func (x *UInt32Rules) ProtoReflect() protoreflect.Message
- func (x *UInt32Rules) Reset()
- func (x *UInt32Rules) String() string
- type UInt64Rules
- func (*UInt64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *UInt64Rules) GetConst() uint64
- func (x *UInt64Rules) GetGt() uint64
- func (x *UInt64Rules) GetGte() uint64
- func (x *UInt64Rules) GetIn() []uint64
- func (x *UInt64Rules) GetLt() uint64
- func (x *UInt64Rules) GetLte() uint64
- func (x *UInt64Rules) GetNotIn() []uint64
- func (*UInt64Rules) ProtoMessage()
- func (x *UInt64Rules) ProtoReflect() protoreflect.Message
- func (x *UInt64Rules) Reset()
- func (x *UInt64Rules) String() string
- type Violation
- func (*Violation) Descriptor() ([]byte, []int)deprecated
- func (x *Violation) GetConstraintId() string
- func (x *Violation) GetFieldPath() string
- func (x *Violation) GetMessage() string
- func (*Violation) ProtoMessage()
- func (x *Violation) ProtoReflect() protoreflect.Message
- func (x *Violation) Reset()
- func (x *Violation) String() string
- type Violations
Constants ¶
This section is empty.
Variables ¶
var ( KnownRegex_name = map[int32]string{ 0: "KNOWN_REGEX_UNSPECIFIED", 1: "KNOWN_REGEX_HTTP_HEADER_NAME", 2: "KNOWN_REGEX_HTTP_HEADER_VALUE", } KnownRegex_value = map[string]int32{ "KNOWN_REGEX_UNSPECIFIED": 0, "KNOWN_REGEX_HTTP_HEADER_NAME": 1, "KNOWN_REGEX_HTTP_HEADER_VALUE": 2, } )
Enum value maps for KnownRegex.
var ( // Rules specify the validations to be performed on this field. By default, // no validation is performed against a field. // // optional buf.validate.FieldConstraints field = 51071; E_Field = &file_buf_validate_validate_proto_extTypes[2] )
Extension fields to descriptorpb.FieldOptions.
var ( // Rules specify the validations to be performed on this message. By default, // no validation is performed against a message. // // optional buf.validate.MessageConstraints message = 51071; E_Message = &file_buf_validate_validate_proto_extTypes[0] )
Extension fields to descriptorpb.MessageOptions.
var ( // Rules specify the validations to be performed on this oneof. By default, // no validation is performed against a oneof. // // optional buf.validate.OneofConstraints oneof = 51071; E_Oneof = &file_buf_validate_validate_proto_extTypes[1] )
Extension fields to descriptorpb.OneofOptions.
var File_buf_validate_expression_proto protoreflect.FileDescriptor
var File_buf_validate_validate_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type AnyRules ¶
type AnyRules struct { // `in` requires the field's `type_url` to be equal to one of the // specified values. If it doesn't match any of the specified values, an error // message is generated. // // “`proto // // message MyAny { // // The `value` field must have a `type_url` equal to one of the specified values. // google.protobuf.Any value = 1 [(buf.validate.field).any.in = ["type.googleapis.com/MyType1", "type.googleapis.com/MyType2"]]; // } // // “` In []string `protobuf:"bytes,2,rep,name=in,proto3" json:"in,omitempty"` // requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated. // // “`proto // // message MyAny { // // The field `value` must not have a `type_url` equal to any of the specified values. // google.protobuf.Any value = 1 [(buf.validate.field).any.not_in = ["type.googleapis.com/ForbiddenType1", "type.googleapis.com/ForbiddenType2"]]; // } // // “` NotIn []string `protobuf:"bytes,3,rep,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
AnyRules describe constraints applied exclusively to the `google.protobuf.Any` well-known type.
func (*AnyRules) Descriptor
deprecated
func (*AnyRules) ProtoMessage ¶
func (*AnyRules) ProtoMessage()
func (*AnyRules) ProtoReflect ¶
func (x *AnyRules) ProtoReflect() protoreflect.Message
type BoolRules ¶
type BoolRules struct { // `const` requires the field value to exactly match the specified boolean value. // If the field value doesn't match, an error message is generated. // // “`proto // // message MyBool { // // value must equal true // bool value = 1 [(buf.validate.field).bool.const = true]; // } // // “` Const *bool `protobuf:"varint,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // contains filtered or unexported fields }
BoolRules describes the constraints applied to `bool` values. These rules may also be applied to the `google.protobuf.BoolValue` Well-Known-Type.
func (*BoolRules) Descriptor
deprecated
func (*BoolRules) ProtoMessage ¶
func (*BoolRules) ProtoMessage()
func (*BoolRules) ProtoReflect ¶
func (x *BoolRules) ProtoReflect() protoreflect.Message
type BytesRules ¶
type BytesRules struct { // `const` requires the field value to exactly match the specified bytes // value. If the field value doesn't match, an error message is generated. // // “`proto // // message MyBytes { // // value must be "\x01\x02\x03\x04" // bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"]; // } // // “` Const []byte `protobuf:"bytes,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `len` requires the field value to have the specified length in bytes. // If the field value doesn't match, an error message is generated. // // “`proto // // message MyBytes { // // value length must be 4 bytes. // optional bytes value = 1 [(buf.validate.field).bytes.len = 4]; // } // // “` Len *uint64 `protobuf:"varint,13,opt,name=len,proto3,oneof" json:"len,omitempty"` // `min_len` requires the field value to have at least the specified minimum // length in bytes. // If the field value doesn't meet the requirement, an error message is generated. // // “`proto // message MyBytes { // // value must be at least 2 bytes. // optional bytes value = 1 [(buf.validate.field).bytes.min_len = 2]; // } // “` MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen,proto3,oneof" json:"min_len,omitempty"` // `max_len` requires the field value to have at most the specified maximum // length in bytes. // If the field value exceeds the requirement, an error message is generated. // // “`proto // message MyBytes { // // value must be at most 6 bytes. // optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6]; // } // “` MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen,proto3,oneof" json:"max_len,omitempty"` // `pattern` requires the field value to match the specified regular // expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). // The value of the field must be valid UTF-8 or validation will fail with a // runtime error. // If the field value doesn't match the pattern, an error message is generated. // // “`proto // message MyBytes { // // value must match pattern "^[a-zA-Z0-9]+$". // optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; // } // “` Pattern *string `protobuf:"bytes,4,opt,name=pattern,proto3,oneof" json:"pattern,omitempty"` // `prefix` requires the field value to have the specified bytes at the // beginning of the string. // If the field value doesn't meet the requirement, an error message is generated. // // “`proto // message MyBytes { // // value does not have prefix \x01\x02 // optional bytes value = 1 [(buf.validate.field).bytes.prefix = "\x01\x02"]; // } // “` Prefix []byte `protobuf:"bytes,5,opt,name=prefix,proto3,oneof" json:"prefix,omitempty"` // `suffix` requires the field value to have the specified bytes at the end // of the string. // If the field value doesn't meet the requirement, an error message is generated. // // “`proto // message MyBytes { // // value does not have suffix \x03\x04 // optional bytes value = 1 [(buf.validate.field).bytes.suffix = "\x03\x04"]; // } // “` Suffix []byte `protobuf:"bytes,6,opt,name=suffix,proto3,oneof" json:"suffix,omitempty"` // `contains` requires the field value to have the specified bytes anywhere in // the string. // If the field value doesn't meet the requirement, an error message is generated. // // “`protobuf // message MyBytes { // // value does not contain \x02\x03 // optional bytes value = 1 [(buf.validate.field).bytes.contains = "\x02\x03"]; // } // “` Contains []byte `protobuf:"bytes,7,opt,name=contains,proto3,oneof" json:"contains,omitempty"` // `in` requires the field value to be equal to one of the specified // values. If the field value doesn't match any of the specified values, an // error message is generated. // // “`protobuf // message MyBytes { // // value must in ["\x01\x02", "\x02\x03", "\x03\x04"] // optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; // } // “` In [][]byte `protobuf:"bytes,8,rep,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to be not equal to any of the specified // values. // If the field value matches any of the specified values, an error message is // generated. // // “`proto // message MyBytes { // // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"] // optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; // } // “` NotIn [][]byte `protobuf:"bytes,9,rep,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // WellKnown rules provide advanced constraints against common byte // patterns // // Types that are assignable to WellKnown: // // *BytesRules_Ip // *BytesRules_Ipv4 // *BytesRules_Ipv6 WellKnown isBytesRules_WellKnown `protobuf_oneof:"well_known"` // contains filtered or unexported fields }
BytesRules describe the constraints applied to `bytes` values. These rules may also be applied to the `google.protobuf.BytesValue` Well-Known-Type.
func (*BytesRules) Descriptor
deprecated
func (*BytesRules) Descriptor() ([]byte, []int)
Deprecated: Use BytesRules.ProtoReflect.Descriptor instead.
func (*BytesRules) GetConst ¶
func (x *BytesRules) GetConst() []byte
func (*BytesRules) GetContains ¶
func (x *BytesRules) GetContains() []byte
func (*BytesRules) GetIn ¶
func (x *BytesRules) GetIn() [][]byte
func (*BytesRules) GetIp ¶
func (x *BytesRules) GetIp() bool
func (*BytesRules) GetIpv4 ¶
func (x *BytesRules) GetIpv4() bool
func (*BytesRules) GetIpv6 ¶
func (x *BytesRules) GetIpv6() bool
func (*BytesRules) GetLen ¶
func (x *BytesRules) GetLen() uint64
func (*BytesRules) GetMaxLen ¶
func (x *BytesRules) GetMaxLen() uint64
func (*BytesRules) GetMinLen ¶
func (x *BytesRules) GetMinLen() uint64
func (*BytesRules) GetNotIn ¶
func (x *BytesRules) GetNotIn() [][]byte
func (*BytesRules) GetPattern ¶
func (x *BytesRules) GetPattern() string
func (*BytesRules) GetPrefix ¶
func (x *BytesRules) GetPrefix() []byte
func (*BytesRules) GetSuffix ¶
func (x *BytesRules) GetSuffix() []byte
func (*BytesRules) GetWellKnown ¶
func (m *BytesRules) GetWellKnown() isBytesRules_WellKnown
func (*BytesRules) ProtoMessage ¶
func (*BytesRules) ProtoMessage()
func (*BytesRules) ProtoReflect ¶
func (x *BytesRules) ProtoReflect() protoreflect.Message
func (*BytesRules) Reset ¶
func (x *BytesRules) Reset()
func (*BytesRules) String ¶
func (x *BytesRules) String() string
type BytesRules_Ip ¶
type BytesRules_Ip struct { // `ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format. // If the field value doesn't meet this constraint, an error message is generated. // // “`proto // message MyBytes { // // value must be a valid IP address // optional bytes value = 1 [(buf.validate.field).bytes.ip = true]; // } // “` Ip bool `protobuf:"varint,10,opt,name=ip,proto3,oneof"` }
type BytesRules_Ipv4 ¶
type BytesRules_Ipv4 struct { // `ipv4` ensures that the field `value` is a valid IPv4 address in byte format. // If the field value doesn't meet this constraint, an error message is generated. // // “`proto // message MyBytes { // // value must be a valid IPv4 address // optional bytes value = 1 [(buf.validate.field).bytes.ipv4 = true]; // } // “` Ipv4 bool `protobuf:"varint,11,opt,name=ipv4,proto3,oneof"` }
type BytesRules_Ipv6 ¶
type BytesRules_Ipv6 struct { // `ipv6` ensures that the field `value` is a valid IPv6 address in byte format. // If the field value doesn't meet this constraint, an error message is generated. // “`proto // message MyBytes { // // value must be a valid IPv6 address // optional bytes value = 1 [(buf.validate.field).bytes.ipv6 = true]; // } // “` Ipv6 bool `protobuf:"varint,12,opt,name=ipv6,proto3,oneof"` }
type Constraint ¶
type Constraint struct { // `id` is a string that serves as a machine-readable name for this Constraint. // It should be unique within its scope, which could be either a message or a field. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // `message` is an optional field that provides a human-readable error message // for this Constraint when the CEL expression evaluates to false. If a // non-empty message is provided, any strings resulting from the CEL // expression evaluation are ignored. Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // `expression` is the actual CEL expression that will be evaluated for // validation. This string must resolve to either a boolean or a string // value. If the expression evaluates to false or a non-empty string, the // validation is considered failed, and the message is rejected. Expression string `protobuf:"bytes,3,opt,name=expression,proto3" json:"expression,omitempty"` // contains filtered or unexported fields }
`Constraint` represents a validation rule written in the Common Expression Language (CEL) syntax. Each Constraint includes a unique identifier, an optional error message, and the CEL expression to evaluate. For more information on CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
```proto
message Foo { option (buf.validate.message).cel = { id: "foo.bar" message: "bar must be greater than 0" expression: "this.bar > 0" }; int32 bar = 1; }
```
func (*Constraint) Descriptor
deprecated
func (*Constraint) Descriptor() ([]byte, []int)
Deprecated: Use Constraint.ProtoReflect.Descriptor instead.
func (*Constraint) GetExpression ¶
func (x *Constraint) GetExpression() string
func (*Constraint) GetId ¶
func (x *Constraint) GetId() string
func (*Constraint) GetMessage ¶
func (x *Constraint) GetMessage() string
func (*Constraint) ProtoMessage ¶
func (*Constraint) ProtoMessage()
func (*Constraint) ProtoReflect ¶
func (x *Constraint) ProtoReflect() protoreflect.Message
func (*Constraint) Reset ¶
func (x *Constraint) Reset()
func (*Constraint) String ¶
func (x *Constraint) String() string
type DoubleRules ¶
type DoubleRules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MyDouble { // // value must equal 42.0 // double value = 1 [(buf.validate.field).double.const = 42.0]; // } // // “` Const *float64 `protobuf:"fixed64,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified // value, an error message is generated. // // “`proto // // message MyDouble { // // value must be less than 10.0 // double value = 1 [(buf.validate.field).double.lt = 10.0]; // } // // “` Lt *float64 `protobuf:"fixed64,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified value // (field <= value). If the field value is greater than the specified value, // an error message is generated. // // “`proto // // message MyDouble { // // value must be less than or equal to 10.0 // double value = 1 [(buf.validate.field).double.lte = 10.0]; // } // // “` Lte *float64 `protobuf:"fixed64,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or `lte`, // the range is reversed, and the field value must be outside the specified // range. If the field value doesn't meet the required conditions, an error // message is generated. // // “`proto // // message MyDouble { // // value must be greater than 5.0 [double.gt] // double value = 1 [(buf.validate.field).double.gt = 5.0]; // // // value must be greater than 5 and less than 10.0 [double.gt_lt] // double other_value = 2 [(buf.validate.field).double = { gt: 5.0, lt: 10.0 }]; // // // value must be greater than 10 or less than 5.0 [double.gt_lt_exclusive] // double another_value = 3 [(buf.validate.field).double = { gt: 10.0, lt: 5.0 }]; // } // // “` Gt *float64 `protobuf:"fixed64,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyDouble { // // value must be greater than or equal to 5.0 [double.gte] // double value = 1 [(buf.validate.field).double.gte = 5.0]; // // // value must be greater than or equal to 5.0 and less than 10.0 [double.gte_lt] // double other_value = 2 [(buf.validate.field).double = { gte: 5.0, lt: 10.0 }]; // // // value must be greater than or equal to 10.0 or less than 5.0 [double.gte_lt_exclusive] // double another_value = 3 [(buf.validate.field).double = { gte: 10.0, lt: 5.0 }]; // } // // “` Gte *float64 `protobuf:"fixed64,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MyDouble { // // value must be in list [1.0, 2.0, 3.0] // repeated double value = 1 (buf.validate.field).double = { in: [1.0, 2.0, 3.0] }; // } // // “` In []float64 `protobuf:"fixed64,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MyDouble { // // value must not be in list [1.0, 2.0, 3.0] // repeated double value = 1 (buf.validate.field).double = { not_in: [1.0, 2.0, 3.0] }; // } // // “` NotIn []float64 `protobuf:"fixed64,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
DoubleRules describes the constraints applied to `double` values. These rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type.
func (*DoubleRules) Descriptor
deprecated
func (*DoubleRules) Descriptor() ([]byte, []int)
Deprecated: Use DoubleRules.ProtoReflect.Descriptor instead.
func (*DoubleRules) GetConst ¶
func (x *DoubleRules) GetConst() float64
func (*DoubleRules) GetGt ¶
func (x *DoubleRules) GetGt() float64
func (*DoubleRules) GetGte ¶
func (x *DoubleRules) GetGte() float64
func (*DoubleRules) GetIn ¶
func (x *DoubleRules) GetIn() []float64
func (*DoubleRules) GetLt ¶
func (x *DoubleRules) GetLt() float64
func (*DoubleRules) GetLte ¶
func (x *DoubleRules) GetLte() float64
func (*DoubleRules) GetNotIn ¶
func (x *DoubleRules) GetNotIn() []float64
func (*DoubleRules) ProtoMessage ¶
func (*DoubleRules) ProtoMessage()
func (*DoubleRules) ProtoReflect ¶
func (x *DoubleRules) ProtoReflect() protoreflect.Message
func (*DoubleRules) Reset ¶
func (x *DoubleRules) Reset()
func (*DoubleRules) String ¶
func (x *DoubleRules) String() string
type DurationRules ¶
type DurationRules struct { // `const` dictates that the field must match the specified value of the `google.protobuf.Duration` type exactly. // If the field's value deviates from the specified value, an error message // will be generated. // // “`proto // // message MyDuration { // // value must equal 5s // google.protobuf.Duration value = 1 [(buf.validate.field).duration.const = "5s"]; // } // // “` Const *durationpb.Duration `protobuf:"bytes,2,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` stipulates that the field must be less than the specified value of the `google.protobuf.Duration` type, // exclusive. If the field's value is greater than or equal to the specified // value, an error message will be generated. // // “`proto // // message MyDuration { // // value must be less than 5s // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = "5s"]; // } // // “` Lt *durationpb.Duration `protobuf:"bytes,3,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` indicates that the field must be less than or equal to the specified // value of the `google.protobuf.Duration` type, inclusive. If the field's value is greater than the specified value, // an error message will be generated. // // “`proto // // message MyDuration { // // value must be less than or equal to 10s // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lte = "10s"]; // } // // “` Lte *durationpb.Duration `protobuf:"bytes,4,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the duration field value to be greater than the specified // value (exclusive). If the value of `gt` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyDuration { // // duration must be greater than 5s [duration.gt] // google.protobuf.Duration value = 1 [(buf.validate.field).duration.gt = { seconds: 5 }]; // // // duration must be greater than 5s and less than 10s [duration.gt_lt] // google.protobuf.Duration another_value = 2 [(buf.validate.field).duration = { gt: { seconds: 5 }, lt: { seconds: 10 } }]; // // // duration must be greater than 10s or less than 5s [duration.gt_lt_exclusive] // google.protobuf.Duration other_value = 3 [(buf.validate.field).duration = { gt: { seconds: 10 }, lt: { seconds: 5 } }]; // } // // “` Gt *durationpb.Duration `protobuf:"bytes,5,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the duration field value to be greater than or equal to the // specified value (exclusive). If the value of `gte` is larger than a // specified `lt` or `lte`, the range is reversed, and the field value must // be outside the specified range. If the field value doesn't meet the // required conditions, an error message is generated. // // “`proto // // message MyDuration { // // duration must be greater than or equal to 5s [duration.gte] // google.protobuf.Duration value = 1 [(buf.validate.field).duration.gte = { seconds: 5 }]; // // // duration must be greater than or equal to 5s and less than 10s [duration.gte_lt] // google.protobuf.Duration another_value = 2 [(buf.validate.field).duration = { gte: { seconds: 5 }, lt: { seconds: 10 } }]; // // // duration must be greater than or equal to 10s or less than 5s [duration.gte_lt_exclusive] // google.protobuf.Duration other_value = 3 [(buf.validate.field).duration = { gte: { seconds: 10 }, lt: { seconds: 5 } }]; // } // // “` Gte *durationpb.Duration `protobuf:"bytes,6,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` asserts that the field must be equal to one of the specified values of the `google.protobuf.Duration` type. // If the field's value doesn't correspond to any of the specified values, // an error message will be generated. // // “`proto // // message MyDuration { // // value must be in list [1s, 2s, 3s] // google.protobuf.Duration value = 1 [(buf.validate.field).duration.in = ["1s", "2s", "3s"]]; // } // // “` In []*durationpb.Duration `protobuf:"bytes,7,rep,name=in,proto3" json:"in,omitempty"` // `not_in` denotes that the field must not be equal to // any of the specified values of the `google.protobuf.Duration` type. // If the field's value matches any of these values, an error message will be // generated. // // “`proto // // message MyDuration { // // value must not be in list [1s, 2s, 3s] // google.protobuf.Duration value = 1 [(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]]; // } // // “` NotIn []*durationpb.Duration `protobuf:"bytes,8,rep,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
DurationRules describe the constraints applied exclusively to the `google.protobuf.Duration` well-known type.
func (*DurationRules) Descriptor
deprecated
func (*DurationRules) Descriptor() ([]byte, []int)
Deprecated: Use DurationRules.ProtoReflect.Descriptor instead.
func (*DurationRules) GetConst ¶
func (x *DurationRules) GetConst() *durationpb.Duration
func (*DurationRules) GetGt ¶
func (x *DurationRules) GetGt() *durationpb.Duration
func (*DurationRules) GetGte ¶
func (x *DurationRules) GetGte() *durationpb.Duration
func (*DurationRules) GetIn ¶
func (x *DurationRules) GetIn() []*durationpb.Duration
func (*DurationRules) GetLt ¶
func (x *DurationRules) GetLt() *durationpb.Duration
func (*DurationRules) GetLte ¶
func (x *DurationRules) GetLte() *durationpb.Duration
func (*DurationRules) GetNotIn ¶
func (x *DurationRules) GetNotIn() []*durationpb.Duration
func (*DurationRules) ProtoMessage ¶
func (*DurationRules) ProtoMessage()
func (*DurationRules) ProtoReflect ¶
func (x *DurationRules) ProtoReflect() protoreflect.Message
func (*DurationRules) Reset ¶
func (x *DurationRules) Reset()
func (*DurationRules) String ¶
func (x *DurationRules) String() string
type EnumRules ¶
type EnumRules struct { // `const` requires the field value to exactly match the specified enum value. // If the field value doesn't match, an error message is generated. // // “`proto // // enum MyEnum { // MY_ENUM_UNSPECIFIED = 0; // MY_ENUM_VALUE1 = 1; // MY_ENUM_VALUE2 = 2; // } // // message MyMessage { // // The field `value` must be exactly MY_ENUM_VALUE1. // MyEnum value = 1 [(buf.validate.field).enum.const = 1]; // } // // “` Const *int32 `protobuf:"varint,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `defined_only` requires the field value to be one of the defined values for // this enum, failing on any undefined value. // // “`proto // // enum MyEnum { // MY_ENUM_UNSPECIFIED = 0; // MY_ENUM_VALUE1 = 1; // MY_ENUM_VALUE2 = 2; // } // // message MyMessage { // // The field `value` must be a defined value of MyEnum. // MyEnum value = 1 [(buf.validate.field).enum.defined_only = true]; // } // // “` DefinedOnly *bool `protobuf:"varint,2,opt,name=defined_only,json=definedOnly,proto3,oneof" json:"defined_only,omitempty"` // `in` requires the field value to be equal to one of the // specified enum values. If the field value doesn't match any of the // specified values, an error message is generated. // // “`proto // // enum MyEnum { // MY_ENUM_UNSPECIFIED = 0; // MY_ENUM_VALUE1 = 1; // MY_ENUM_VALUE2 = 2; // } // // message MyMessage { // // The field `value` must be equal to one of the specified values. // MyEnum value = 1 [(buf.validate.field).enum.in = {1, 2}]; // } // // “` In []int32 `protobuf:"varint,3,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to be not equal to any of the // specified enum values. If the field value matches one of the specified // values, an error message is generated. // // “`proto // // enum MyEnum { // MY_ENUM_UNSPECIFIED = 0; // MY_ENUM_VALUE1 = 1; // MY_ENUM_VALUE2 = 2; // } // // message MyMessage { // // The field `value` must not be equal to any of the specified values. // MyEnum value = 1 [(buf.validate.field).enum.not_in = {1, 2}]; // } // // “` NotIn []int32 `protobuf:"varint,4,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
EnumRules describe the constraints applied to `enum` values.
func (*EnumRules) Descriptor
deprecated
func (*EnumRules) GetDefinedOnly ¶
func (*EnumRules) ProtoMessage ¶
func (*EnumRules) ProtoMessage()
func (*EnumRules) ProtoReflect ¶
func (x *EnumRules) ProtoReflect() protoreflect.Message
type FieldConstraints ¶
type FieldConstraints struct { // `Constraint` is a repeated field used to represent a textual expression // in the Common Expression Language (CEL) syntax. For more information on // CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md). // // “`proto // // message MyMessage { // // The field `value` must be greater than 42. // optional int32 value = 1 [(buf.validate.field).cel = { // id: "my_message.value", // message: "value must be greater than 42", // expression: "this > 42", // }]; // } // // “` Cel []*Constraint `protobuf:"bytes,23,rep,name=cel,proto3" json:"cel,omitempty"` // `skipped` is an optional boolean attribute that specifies that the // validation rules of this field should not be evaluated. If skipped is set to // true, any validation rules set for the field will be ignored. // // “`proto // // message MyMessage { // // The field `value` must not be set. // optional MyOtherMessage value = 1 [(buf.validate.field).skipped = true]; // } // // “` Skipped bool `protobuf:"varint,24,opt,name=skipped,proto3" json:"skipped,omitempty"` // `required` is an optional boolean attribute that specifies that // this field must be set. If required is set to true, the field value must // not be empty; otherwise, an error message will be generated. // // “`proto // // message MyMessage { // // The field `value` must be set. // optional MyOtherMessage value = 1 [(buf.validate.field).required = true]; // } // // “` Required bool `protobuf:"varint,25,opt,name=required,proto3" json:"required,omitempty"` // `ignore_empty` specifies that the validation rules of this field should be // evaluated only if the field isn't empty. If the field is empty, no validation // rules are applied. // // “`proto // // message MyRepeated { // // The field `value` validation rules should be evaluated only if the field isn't empty. // repeated string value = 1 [(buf.validate.field).ignore_empty = true]; // } // // “` IgnoreEmpty bool `protobuf:"varint,26,opt,name=ignore_empty,json=ignoreEmpty,proto3" json:"ignore_empty,omitempty"` // Types that are assignable to Type: // // *FieldConstraints_Float // *FieldConstraints_Double // *FieldConstraints_Int32 // *FieldConstraints_Int64 // *FieldConstraints_Uint32 // *FieldConstraints_Uint64 // *FieldConstraints_Sint32 // *FieldConstraints_Sint64 // *FieldConstraints_Fixed32 // *FieldConstraints_Fixed64 // *FieldConstraints_Sfixed32 // *FieldConstraints_Sfixed64 // *FieldConstraints_Bool // *FieldConstraints_String_ // *FieldConstraints_Bytes // *FieldConstraints_Enum // *FieldConstraints_Repeated // *FieldConstraints_Map // *FieldConstraints_Any // *FieldConstraints_Duration // *FieldConstraints_Timestamp Type isFieldConstraints_Type `protobuf_oneof:"type"` // contains filtered or unexported fields }
FieldRules encapsulates the rules for each type of field. Depending on the field, the correct set should be used to ensure proper validations.
func (*FieldConstraints) Descriptor
deprecated
func (*FieldConstraints) Descriptor() ([]byte, []int)
Deprecated: Use FieldConstraints.ProtoReflect.Descriptor instead.
func (*FieldConstraints) GetAny ¶
func (x *FieldConstraints) GetAny() *AnyRules
func (*FieldConstraints) GetBool ¶
func (x *FieldConstraints) GetBool() *BoolRules
func (*FieldConstraints) GetBytes ¶
func (x *FieldConstraints) GetBytes() *BytesRules
func (*FieldConstraints) GetCel ¶
func (x *FieldConstraints) GetCel() []*Constraint
func (*FieldConstraints) GetDouble ¶
func (x *FieldConstraints) GetDouble() *DoubleRules
func (*FieldConstraints) GetDuration ¶
func (x *FieldConstraints) GetDuration() *DurationRules
func (*FieldConstraints) GetEnum ¶
func (x *FieldConstraints) GetEnum() *EnumRules
func (*FieldConstraints) GetFixed32 ¶
func (x *FieldConstraints) GetFixed32() *Fixed32Rules
func (*FieldConstraints) GetFixed64 ¶
func (x *FieldConstraints) GetFixed64() *Fixed64Rules
func (*FieldConstraints) GetFloat ¶
func (x *FieldConstraints) GetFloat() *FloatRules
func (*FieldConstraints) GetIgnoreEmpty ¶
func (x *FieldConstraints) GetIgnoreEmpty() bool
func (*FieldConstraints) GetInt32 ¶
func (x *FieldConstraints) GetInt32() *Int32Rules
func (*FieldConstraints) GetInt64 ¶
func (x *FieldConstraints) GetInt64() *Int64Rules
func (*FieldConstraints) GetMap ¶
func (x *FieldConstraints) GetMap() *MapRules
func (*FieldConstraints) GetRepeated ¶
func (x *FieldConstraints) GetRepeated() *RepeatedRules
func (*FieldConstraints) GetRequired ¶
func (x *FieldConstraints) GetRequired() bool
func (*FieldConstraints) GetSfixed32 ¶
func (x *FieldConstraints) GetSfixed32() *SFixed32Rules
func (*FieldConstraints) GetSfixed64 ¶
func (x *FieldConstraints) GetSfixed64() *SFixed64Rules
func (*FieldConstraints) GetSint32 ¶
func (x *FieldConstraints) GetSint32() *SInt32Rules
func (*FieldConstraints) GetSint64 ¶
func (x *FieldConstraints) GetSint64() *SInt64Rules
func (*FieldConstraints) GetSkipped ¶
func (x *FieldConstraints) GetSkipped() bool
func (*FieldConstraints) GetString_ ¶
func (x *FieldConstraints) GetString_() *StringRules
func (*FieldConstraints) GetTimestamp ¶
func (x *FieldConstraints) GetTimestamp() *TimestampRules
func (*FieldConstraints) GetType ¶
func (m *FieldConstraints) GetType() isFieldConstraints_Type
func (*FieldConstraints) GetUint32 ¶
func (x *FieldConstraints) GetUint32() *UInt32Rules
func (*FieldConstraints) GetUint64 ¶
func (x *FieldConstraints) GetUint64() *UInt64Rules
func (*FieldConstraints) ProtoMessage ¶
func (*FieldConstraints) ProtoMessage()
func (*FieldConstraints) ProtoReflect ¶
func (x *FieldConstraints) ProtoReflect() protoreflect.Message
func (*FieldConstraints) Reset ¶
func (x *FieldConstraints) Reset()
func (*FieldConstraints) String ¶
func (x *FieldConstraints) String() string
type FieldConstraints_Any ¶
type FieldConstraints_Any struct { // Well-Known Field Types Any *AnyRules `protobuf:"bytes,20,opt,name=any,proto3,oneof"` }
type FieldConstraints_Bool ¶
type FieldConstraints_Bool struct {
Bool *BoolRules `protobuf:"bytes,13,opt,name=bool,proto3,oneof"`
}
type FieldConstraints_Bytes ¶
type FieldConstraints_Bytes struct {
Bytes *BytesRules `protobuf:"bytes,15,opt,name=bytes,proto3,oneof"`
}
type FieldConstraints_Double ¶
type FieldConstraints_Double struct {
Double *DoubleRules `protobuf:"bytes,2,opt,name=double,proto3,oneof"`
}
type FieldConstraints_Duration ¶
type FieldConstraints_Duration struct {
Duration *DurationRules `protobuf:"bytes,21,opt,name=duration,proto3,oneof"`
}
type FieldConstraints_Enum ¶
type FieldConstraints_Enum struct { // Complex Field Types Enum *EnumRules `protobuf:"bytes,16,opt,name=enum,proto3,oneof"` }
type FieldConstraints_Fixed32 ¶
type FieldConstraints_Fixed32 struct {
Fixed32 *Fixed32Rules `protobuf:"bytes,9,opt,name=fixed32,proto3,oneof"`
}
type FieldConstraints_Fixed64 ¶
type FieldConstraints_Fixed64 struct {
Fixed64 *Fixed64Rules `protobuf:"bytes,10,opt,name=fixed64,proto3,oneof"`
}
type FieldConstraints_Float ¶
type FieldConstraints_Float struct { // Scalar Field Types Float *FloatRules `protobuf:"bytes,1,opt,name=float,proto3,oneof"` }
type FieldConstraints_Int32 ¶
type FieldConstraints_Int32 struct {
Int32 *Int32Rules `protobuf:"bytes,3,opt,name=int32,proto3,oneof"`
}
type FieldConstraints_Int64 ¶
type FieldConstraints_Int64 struct {
Int64 *Int64Rules `protobuf:"bytes,4,opt,name=int64,proto3,oneof"`
}
type FieldConstraints_Map ¶
type FieldConstraints_Map struct {
Map *MapRules `protobuf:"bytes,19,opt,name=map,proto3,oneof"`
}
type FieldConstraints_Repeated ¶
type FieldConstraints_Repeated struct {
Repeated *RepeatedRules `protobuf:"bytes,18,opt,name=repeated,proto3,oneof"`
}
type FieldConstraints_Sfixed32 ¶
type FieldConstraints_Sfixed32 struct {
Sfixed32 *SFixed32Rules `protobuf:"bytes,11,opt,name=sfixed32,proto3,oneof"`
}
type FieldConstraints_Sfixed64 ¶
type FieldConstraints_Sfixed64 struct {
Sfixed64 *SFixed64Rules `protobuf:"bytes,12,opt,name=sfixed64,proto3,oneof"`
}
type FieldConstraints_Sint32 ¶
type FieldConstraints_Sint32 struct {
Sint32 *SInt32Rules `protobuf:"bytes,7,opt,name=sint32,proto3,oneof"`
}
type FieldConstraints_Sint64 ¶
type FieldConstraints_Sint64 struct {
Sint64 *SInt64Rules `protobuf:"bytes,8,opt,name=sint64,proto3,oneof"`
}
type FieldConstraints_String_ ¶
type FieldConstraints_String_ struct {
String_ *StringRules `protobuf:"bytes,14,opt,name=string,proto3,oneof"`
}
type FieldConstraints_Timestamp ¶
type FieldConstraints_Timestamp struct {
Timestamp *TimestampRules `protobuf:"bytes,22,opt,name=timestamp,proto3,oneof"`
}
type FieldConstraints_Uint32 ¶
type FieldConstraints_Uint32 struct {
Uint32 *UInt32Rules `protobuf:"bytes,5,opt,name=uint32,proto3,oneof"`
}
type FieldConstraints_Uint64 ¶
type FieldConstraints_Uint64 struct {
Uint64 *UInt64Rules `protobuf:"bytes,6,opt,name=uint64,proto3,oneof"`
}
type Fixed32Rules ¶
type Fixed32Rules struct { // `const` requires the field value to exactly match the specified value. // If the field value doesn't match, an error message is generated. // // “`proto // // message MyFixed32 { // // value must equal 42 // fixed32 value = 1 [(buf.validate.field).fixed32.const = 42]; // } // // “` Const *uint32 `protobuf:"fixed32,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified value, // an error message is generated. // // “`proto // // message MyFixed32 { // // value must be less than 10 // fixed32 value = 1 [(buf.validate.field).fixed32.lt = 10]; // } // // “` Lt *uint32 `protobuf:"fixed32,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MyFixed32 { // // value must be less than or equal to 10 // fixed32 value = 1 [(buf.validate.field).fixed32.lte = 10]; // } // // “` Lte *uint32 `protobuf:"fixed32,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyFixed32 { // // value must be greater than 5 [fixed32.gt] // fixed32 value = 1 [(buf.validate.field).fixed32.gt = 5]; // // // value must be greater than 5 and less than 10 [fixed32.gt_lt] // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [fixed32.gt_lt_exclusive] // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gt: 10, lt: 5 }]; // } // // “` Gt *uint32 `protobuf:"fixed32,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyFixed32 { // // value must be greater than or equal to 5 [fixed32.gte] // fixed32 value = 1 [(buf.validate.field).fixed32.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [fixed32.gte_lt] // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [fixed32.gte_lt_exclusive] // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gte: 10, lt: 5 }]; // } // // “` Gte *uint32 `protobuf:"fixed32,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message // is generated. // // “`proto // // message MyFixed32 { // // value must be in list [1, 2, 3] // repeated fixed32 value = 1 (buf.validate.field).fixed32 = { in: [1, 2, 3] }; // } // // “` In []uint32 `protobuf:"fixed32,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MyFixed32 { // // value must not be in list [1, 2, 3] // repeated fixed32 value = 1 (buf.validate.field).fixed32 = { not_in: [1, 2, 3] }; // } // // “` NotIn []uint32 `protobuf:"fixed32,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
Fixed32Rules describes the constraints applied to `fixed32` values.
func (*Fixed32Rules) Descriptor
deprecated
func (*Fixed32Rules) Descriptor() ([]byte, []int)
Deprecated: Use Fixed32Rules.ProtoReflect.Descriptor instead.
func (*Fixed32Rules) GetConst ¶
func (x *Fixed32Rules) GetConst() uint32
func (*Fixed32Rules) GetGt ¶
func (x *Fixed32Rules) GetGt() uint32
func (*Fixed32Rules) GetGte ¶
func (x *Fixed32Rules) GetGte() uint32
func (*Fixed32Rules) GetIn ¶
func (x *Fixed32Rules) GetIn() []uint32
func (*Fixed32Rules) GetLt ¶
func (x *Fixed32Rules) GetLt() uint32
func (*Fixed32Rules) GetLte ¶
func (x *Fixed32Rules) GetLte() uint32
func (*Fixed32Rules) GetNotIn ¶
func (x *Fixed32Rules) GetNotIn() []uint32
func (*Fixed32Rules) ProtoMessage ¶
func (*Fixed32Rules) ProtoMessage()
func (*Fixed32Rules) ProtoReflect ¶
func (x *Fixed32Rules) ProtoReflect() protoreflect.Message
func (*Fixed32Rules) Reset ¶
func (x *Fixed32Rules) Reset()
func (*Fixed32Rules) String ¶
func (x *Fixed32Rules) String() string
type Fixed64Rules ¶
type Fixed64Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MyFixed64 { // // value must equal 42 // fixed64 value = 1 [(buf.validate.field).fixed64.const = 42]; // } // // “` Const *uint64 `protobuf:"fixed64,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified value, // an error message is generated. // // “`proto // // message MyFixed64 { // // value must be less than 10 // fixed64 value = 1 [(buf.validate.field).fixed64.lt = 10]; // } // // “` Lt *uint64 `protobuf:"fixed64,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MyFixed64 { // // value must be less than or equal to 10 // fixed64 value = 1 [(buf.validate.field).fixed64.lte = 10]; // } // // “` Lte *uint64 `protobuf:"fixed64,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyFixed64 { // // value must be greater than 5 [fixed64.gt] // fixed64 value = 1 [(buf.validate.field).fixed64.gt = 5]; // // // value must be greater than 5 and less than 10 [fixed64.gt_lt] // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [fixed64.gt_lt_exclusive] // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gt: 10, lt: 5 }]; // } // // “` Gt *uint64 `protobuf:"fixed64,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyFixed64 { // // value must be greater than or equal to 5 [fixed64.gte] // fixed64 value = 1 [(buf.validate.field).fixed64.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [fixed64.gte_lt] // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [fixed64.gte_lt_exclusive] // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gte: 10, lt: 5 }]; // } // // “` Gte *uint64 `protobuf:"fixed64,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MyFixed64 { // // value must be in list [1, 2, 3] // repeated fixed64 value = 1 (buf.validate.field).fixed64 = { in: [1, 2, 3] }; // } // // “` In []uint64 `protobuf:"fixed64,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MyFixed64 { // // value must not be in list [1, 2, 3] // repeated fixed64 value = 1 (buf.validate.field).fixed64 = { not_in: [1, 2, 3] }; // } // // “` NotIn []uint64 `protobuf:"fixed64,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
Fixed64Rules describes the constraints applied to `fixed64` values.
func (*Fixed64Rules) Descriptor
deprecated
func (*Fixed64Rules) Descriptor() ([]byte, []int)
Deprecated: Use Fixed64Rules.ProtoReflect.Descriptor instead.
func (*Fixed64Rules) GetConst ¶
func (x *Fixed64Rules) GetConst() uint64
func (*Fixed64Rules) GetGt ¶
func (x *Fixed64Rules) GetGt() uint64
func (*Fixed64Rules) GetGte ¶
func (x *Fixed64Rules) GetGte() uint64
func (*Fixed64Rules) GetIn ¶
func (x *Fixed64Rules) GetIn() []uint64
func (*Fixed64Rules) GetLt ¶
func (x *Fixed64Rules) GetLt() uint64
func (*Fixed64Rules) GetLte ¶
func (x *Fixed64Rules) GetLte() uint64
func (*Fixed64Rules) GetNotIn ¶
func (x *Fixed64Rules) GetNotIn() []uint64
func (*Fixed64Rules) ProtoMessage ¶
func (*Fixed64Rules) ProtoMessage()
func (*Fixed64Rules) ProtoReflect ¶
func (x *Fixed64Rules) ProtoReflect() protoreflect.Message
func (*Fixed64Rules) Reset ¶
func (x *Fixed64Rules) Reset()
func (*Fixed64Rules) String ¶
func (x *Fixed64Rules) String() string
type FloatRules ¶
type FloatRules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MyFloat { // // value must equal 42.0 // float value = 1 [(buf.validate.field).float.const = 42.0]; // } // // “` Const *float32 `protobuf:"fixed32,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified value, // an error message is generated. // // “`proto // // message MyFloat { // // value must be less than 10.0 // float value = 1 [(buf.validate.field).float.lt = 10.0]; // } // // “` Lt *float32 `protobuf:"fixed32,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MyFloat { // // value must be less than or equal to 10.0 // float value = 1 [(buf.validate.field).float.lte = 10.0]; // } // // “` Lte *float32 `protobuf:"fixed32,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyFloat { // // value must be greater than 5.0 [float.gt] // float value = 1 [(buf.validate.field).float.gt = 5.0]; // // // value must be greater than 5 and less than 10.0 [float.gt_lt] // float other_value = 2 [(buf.validate.field).float = { gt: 5.0, lt: 10.0 }]; // // // value must be greater than 10 or less than 5.0 [float.gt_lt_exclusive] // float another_value = 3 [(buf.validate.field).float = { gt: 10.0, lt: 5.0 }]; // } // // “` Gt *float32 `protobuf:"fixed32,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyFloat { // // value must be greater than or equal to 5.0 [float.gte] // float value = 1 [(buf.validate.field).float.gte = 5.0]; // // // value must be greater than or equal to 5.0 and less than 10.0 [float.gte_lt] // float other_value = 2 [(buf.validate.field).float = { gte: 5.0, lt: 10.0 }]; // // // value must be greater than or equal to 10.0 or less than 5.0 [float.gte_lt_exclusive] // float another_value = 3 [(buf.validate.field).float = { gte: 10.0, lt: 5.0 }]; // } // // “` Gte *float32 `protobuf:"fixed32,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message // is generated. // // “`proto // // message MyFloat { // // value must be in list [1.0, 2.0, 3.0] // repeated float value = 1 (buf.validate.field).float = { in: [1.0, 2.0, 3.0] }; // } // // “` In []float32 `protobuf:"fixed32,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MyFloat { // // value must not be in list [1.0, 2.0, 3.0] // repeated float value = 1 (buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] }; // } // // “` NotIn []float32 `protobuf:"fixed32,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
FloatRules describes the constraints applied to `float` values. These rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type.
func (*FloatRules) Descriptor
deprecated
func (*FloatRules) Descriptor() ([]byte, []int)
Deprecated: Use FloatRules.ProtoReflect.Descriptor instead.
func (*FloatRules) GetConst ¶
func (x *FloatRules) GetConst() float32
func (*FloatRules) GetGt ¶
func (x *FloatRules) GetGt() float32
func (*FloatRules) GetGte ¶
func (x *FloatRules) GetGte() float32
func (*FloatRules) GetIn ¶
func (x *FloatRules) GetIn() []float32
func (*FloatRules) GetLt ¶
func (x *FloatRules) GetLt() float32
func (*FloatRules) GetLte ¶
func (x *FloatRules) GetLte() float32
func (*FloatRules) GetNotIn ¶
func (x *FloatRules) GetNotIn() []float32
func (*FloatRules) ProtoMessage ¶
func (*FloatRules) ProtoMessage()
func (*FloatRules) ProtoReflect ¶
func (x *FloatRules) ProtoReflect() protoreflect.Message
func (*FloatRules) Reset ¶
func (x *FloatRules) Reset()
func (*FloatRules) String ¶
func (x *FloatRules) String() string
type Int32Rules ¶
type Int32Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MyInt32 { // // value must equal 42 // int32 value = 1 [(buf.validate.field).int32.const = 42]; // } // // “` Const *int32 `protobuf:"varint,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field // < value). If the field value is equal to or greater than the specified // value, an error message is generated. // // “`proto // // message MyInt32 { // // value must be less than 10 // int32 value = 1 [(buf.validate.field).int32.lt = 10]; // } // // “` Lt *int32 `protobuf:"varint,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MyInt32 { // // value must be less than or equal to 10 // int32 value = 1 [(buf.validate.field).int32.lte = 10]; // } // // “` Lte *int32 `protobuf:"varint,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyInt32 { // // value must be greater than 5 [int32.gt] // int32 value = 1 [(buf.validate.field).int32.gt = 5]; // // // value must be greater than 5 and less than 10 [int32.gt_lt] // int32 other_value = 2 [(buf.validate.field).int32 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [int32.gt_lt_exclusive] // int32 another_value = 3 [(buf.validate.field).int32 = { gt: 10, lt: 5 }]; // } // // “` Gt *int32 `protobuf:"varint,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified value // (exclusive). If the value of `gte` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyInt32 { // // value must be greater than or equal to 5 [int32.gte] // int32 value = 1 [(buf.validate.field).int32.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [int32.gte_lt] // int32 other_value = 2 [(buf.validate.field).int32 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [int32.gte_lt_exclusive] // int32 another_value = 3 [(buf.validate.field).int32 = { gte: 10, lt: 5 }]; // } // // “` Gte *int32 `protobuf:"varint,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MyInt32 { // // value must be in list [1, 2, 3] // repeated int32 value = 1 (buf.validate.field).int32 = { in: [1, 2, 3] }; // } // // “` In []int32 `protobuf:"varint,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error message // is generated. // // “`proto // // message MyInt32 { // // value must not be in list [1, 2, 3] // repeated int32 value = 1 (buf.validate.field).int32 = { not_in: [1, 2, 3] }; // } // // “` NotIn []int32 `protobuf:"varint,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
Int32Rules describes the constraints applied to `int32` values. These rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type.
func (*Int32Rules) Descriptor
deprecated
func (*Int32Rules) Descriptor() ([]byte, []int)
Deprecated: Use Int32Rules.ProtoReflect.Descriptor instead.
func (*Int32Rules) GetConst ¶
func (x *Int32Rules) GetConst() int32
func (*Int32Rules) GetGt ¶
func (x *Int32Rules) GetGt() int32
func (*Int32Rules) GetGte ¶
func (x *Int32Rules) GetGte() int32
func (*Int32Rules) GetIn ¶
func (x *Int32Rules) GetIn() []int32
func (*Int32Rules) GetLt ¶
func (x *Int32Rules) GetLt() int32
func (*Int32Rules) GetLte ¶
func (x *Int32Rules) GetLte() int32
func (*Int32Rules) GetNotIn ¶
func (x *Int32Rules) GetNotIn() []int32
func (*Int32Rules) ProtoMessage ¶
func (*Int32Rules) ProtoMessage()
func (*Int32Rules) ProtoReflect ¶
func (x *Int32Rules) ProtoReflect() protoreflect.Message
func (*Int32Rules) Reset ¶
func (x *Int32Rules) Reset()
func (*Int32Rules) String ¶
func (x *Int32Rules) String() string
type Int64Rules ¶
type Int64Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MyInt64 { // // value must equal 42 // int64 value = 1 [(buf.validate.field).int64.const = 42]; // } // // “` Const *int64 `protobuf:"varint,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified value, // an error message is generated. // // “`proto // // message MyInt64 { // // value must be less than 10 // int64 value = 1 [(buf.validate.field).int64.lt = 10]; // } // // “` Lt *int64 `protobuf:"varint,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MyInt64 { // // value must be less than or equal to 10 // int64 value = 1 [(buf.validate.field).int64.lte = 10]; // } // // “` Lte *int64 `protobuf:"varint,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyInt64 { // // value must be greater than 5 [int64.gt] // int64 value = 1 [(buf.validate.field).int64.gt = 5]; // // // value must be greater than 5 and less than 10 [int64.gt_lt] // int64 other_value = 2 [(buf.validate.field).int64 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [int64.gt_lt_exclusive] // int64 another_value = 3 [(buf.validate.field).int64 = { gt: 10, lt: 5 }]; // } // // “` Gt *int64 `protobuf:"varint,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyInt64 { // // value must be greater than or equal to 5 [int64.gte] // int64 value = 1 [(buf.validate.field).int64.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [int64.gte_lt] // int64 other_value = 2 [(buf.validate.field).int64 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [int64.gte_lt_exclusive] // int64 another_value = 3 [(buf.validate.field).int64 = { gte: 10, lt: 5 }]; // } // // “` Gte *int64 `protobuf:"varint,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MyInt64 { // // value must be in list [1, 2, 3] // repeated int64 value = 1 (buf.validate.field).int64 = { in: [1, 2, 3] }; // } // // “` In []int64 `protobuf:"varint,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MyInt64 { // // value must not be in list [1, 2, 3] // repeated int64 value = 1 (buf.validate.field).int64 = { not_in: [1, 2, 3] }; // } // // “` NotIn []int64 `protobuf:"varint,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
Int64Rules describes the constraints applied to `int64` values. These rules may also be applied to the `google.protobuf.Int64Value` Well-Known-Type.
func (*Int64Rules) Descriptor
deprecated
func (*Int64Rules) Descriptor() ([]byte, []int)
Deprecated: Use Int64Rules.ProtoReflect.Descriptor instead.
func (*Int64Rules) GetConst ¶
func (x *Int64Rules) GetConst() int64
func (*Int64Rules) GetGt ¶
func (x *Int64Rules) GetGt() int64
func (*Int64Rules) GetGte ¶
func (x *Int64Rules) GetGte() int64
func (*Int64Rules) GetIn ¶
func (x *Int64Rules) GetIn() []int64
func (*Int64Rules) GetLt ¶
func (x *Int64Rules) GetLt() int64
func (*Int64Rules) GetLte ¶
func (x *Int64Rules) GetLte() int64
func (*Int64Rules) GetNotIn ¶
func (x *Int64Rules) GetNotIn() []int64
func (*Int64Rules) ProtoMessage ¶
func (*Int64Rules) ProtoMessage()
func (*Int64Rules) ProtoReflect ¶
func (x *Int64Rules) ProtoReflect() protoreflect.Message
func (*Int64Rules) Reset ¶
func (x *Int64Rules) Reset()
func (*Int64Rules) String ¶
func (x *Int64Rules) String() string
type KnownRegex ¶
type KnownRegex int32
WellKnownRegex contain some well-known patterns.
const ( KnownRegex_KNOWN_REGEX_UNSPECIFIED KnownRegex = 0 // HTTP header name as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2). KnownRegex_KNOWN_REGEX_HTTP_HEADER_NAME KnownRegex = 1 // HTTP header value as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2.4). KnownRegex_KNOWN_REGEX_HTTP_HEADER_VALUE KnownRegex = 2 )
func (KnownRegex) Descriptor ¶
func (KnownRegex) Descriptor() protoreflect.EnumDescriptor
func (KnownRegex) Enum ¶
func (x KnownRegex) Enum() *KnownRegex
func (KnownRegex) EnumDescriptor
deprecated
func (KnownRegex) EnumDescriptor() ([]byte, []int)
Deprecated: Use KnownRegex.Descriptor instead.
func (KnownRegex) Number ¶
func (x KnownRegex) Number() protoreflect.EnumNumber
func (KnownRegex) String ¶
func (x KnownRegex) String() string
func (KnownRegex) Type ¶
func (KnownRegex) Type() protoreflect.EnumType
type MapRules ¶
type MapRules struct { // Specifies the minimum number of key-value pairs allowed. If the field has // fewer key-value pairs than specified, an error message is generated. // // “`proto // // message MyMap { // // The field `value` must have at least 2 key-value pairs. // map<string, string> value = 1 [(buf.validate.field).map.min_pairs = 2]; // } // // “` MinPairs *uint64 `protobuf:"varint,1,opt,name=min_pairs,json=minPairs,proto3,oneof" json:"min_pairs,omitempty"` // Specifies the maximum number of key-value pairs allowed. If the field has // more key-value pairs than specified, an error message is generated. // // “`proto // // message MyMap { // // The field `value` must have at most 3 key-value pairs. // map<string, string> value = 1 [(buf.validate.field).map.max_pairs = 3]; // } // // “` MaxPairs *uint64 `protobuf:"varint,2,opt,name=max_pairs,json=maxPairs,proto3,oneof" json:"max_pairs,omitempty"` // Specifies the constraints to be applied to each key in the field. // // “`proto // // message MyMap { // // The keys in the field `value` must follow the specified constraints. // map<string, string> value = 1 [(buf.validate.field).map.keys = { // string: { // min_len: 3 // max_len: 10 // } // }]; // } // // “` Keys *FieldConstraints `protobuf:"bytes,4,opt,name=keys,proto3,oneof" json:"keys,omitempty"` // Specifies the constraints to be applied to the value of each key in the // field. Message values will still have their validations evaluated unless // skip is specified here. // // “`proto // // message MyMap { // // The values in the field `value` must follow the specified constraints. // map<string, string> value = 1 [(buf.validate.field).map.values = { // string: { // min_len: 5 // max_len: 20 // } // }]; // } // // “` Values *FieldConstraints `protobuf:"bytes,5,opt,name=values,proto3,oneof" json:"values,omitempty"` // contains filtered or unexported fields }
MapRules describe the constraints applied to `map` values.
func (*MapRules) Descriptor
deprecated
func (*MapRules) GetKeys ¶
func (x *MapRules) GetKeys() *FieldConstraints
func (*MapRules) GetMaxPairs ¶
func (*MapRules) GetMinPairs ¶
func (*MapRules) GetValues ¶
func (x *MapRules) GetValues() *FieldConstraints
func (*MapRules) ProtoMessage ¶
func (*MapRules) ProtoMessage()
func (*MapRules) ProtoReflect ¶
func (x *MapRules) ProtoReflect() protoreflect.Message
type MessageConstraints ¶
type MessageConstraints struct { // disabled is a boolean flag that, when set to true, nullifies any validation rules for this message. // This includes any fields within the message that would otherwise support validation. // // “`proto // // message MyMessage { // // validation will be bypassed for this message // option (buf.validate.message).disabled = true; // } // // “` Disabled *bool `protobuf:"varint,1,opt,name=disabled,proto3,oneof" json:"disabled,omitempty"` // cel is a repeated field of type Constraint. Each Constraint specifies a validation rule to be applied to this message. // These constraints are written in Common Expression Language (CEL) syntax. For more information on // CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md). // // “`proto // // message MyMessage { // // The field `foo` must be greater than 42. // option (buf.validate.message).cel = { // id: "my_message.value", // message: "value must be greater than 42", // expression: "this.foo > 42", // }; // optional int32 foo = 1; // } // // “` Cel []*Constraint `protobuf:"bytes,3,rep,name=cel,proto3" json:"cel,omitempty"` // contains filtered or unexported fields }
MessageConstraints represents validation rules that are applied to the entire message. It includes disabling options and a list of Constraint messages representing Common Expression Language (CEL) validation rules.
func (*MessageConstraints) Descriptor
deprecated
func (*MessageConstraints) Descriptor() ([]byte, []int)
Deprecated: Use MessageConstraints.ProtoReflect.Descriptor instead.
func (*MessageConstraints) GetCel ¶
func (x *MessageConstraints) GetCel() []*Constraint
func (*MessageConstraints) GetDisabled ¶
func (x *MessageConstraints) GetDisabled() bool
func (*MessageConstraints) ProtoMessage ¶
func (*MessageConstraints) ProtoMessage()
func (*MessageConstraints) ProtoReflect ¶
func (x *MessageConstraints) ProtoReflect() protoreflect.Message
func (*MessageConstraints) Reset ¶
func (x *MessageConstraints) Reset()
func (*MessageConstraints) String ¶
func (x *MessageConstraints) String() string
type OneofConstraints ¶
type OneofConstraints struct { // `required` is an optional boolean attribute that ensures that // exactly one of the field options in a oneof is set; validation fails if // no fields in the oneof are set. // // “`proto // // message MyMessage { // oneof value { // // The field `a` or `b` must be set. // option [(buf.validate.oneof).required = true] // optional string a = 1; // optional string b = 2; // } // } // // “` Required *bool `protobuf:"varint,1,opt,name=required,proto3,oneof" json:"required,omitempty"` // contains filtered or unexported fields }
The `OneofConstraints` message type enables you to manage constraints for oneof fields in your protobuf messages. Use the `required` constraint to ensure that exactly one of the fields within a oneof is set; validation will fail if none of the fields in the oneof are set:
func (*OneofConstraints) Descriptor
deprecated
func (*OneofConstraints) Descriptor() ([]byte, []int)
Deprecated: Use OneofConstraints.ProtoReflect.Descriptor instead.
func (*OneofConstraints) GetRequired ¶
func (x *OneofConstraints) GetRequired() bool
func (*OneofConstraints) ProtoMessage ¶
func (*OneofConstraints) ProtoMessage()
func (*OneofConstraints) ProtoReflect ¶
func (x *OneofConstraints) ProtoReflect() protoreflect.Message
func (*OneofConstraints) Reset ¶
func (x *OneofConstraints) Reset()
func (*OneofConstraints) String ¶
func (x *OneofConstraints) String() string
type RepeatedRules ¶
type RepeatedRules struct { // `min_items` requires that this field must contain at least the specified // minimum number of items. // // “`proto // // message MyRepeated { // // value must contain at least 2 items // repeated string value = 1 [(buf.validate.field).repeated.min_items = 2]; // } // // “` MinItems *uint64 `protobuf:"varint,1,opt,name=min_items,json=minItems,proto3,oneof" json:"min_items,omitempty"` // `max_items` denotes that this field must not exceed a // certain number of items as the upper limit. If the field contains more // items than specified, an error message will be generated, requiring the // field to maintain no more than the specified number of items. // // “`proto // // message MyRepeated { // // value must contain no more than 3 item(s) // repeated string value = 1 [(buf.validate.field).repeated.max_items = 3]; // } // // “` MaxItems *uint64 `protobuf:"varint,2,opt,name=max_items,json=maxItems,proto3,oneof" json:"max_items,omitempty"` // `unique` indicates that all elements in this field must // be unique. This constraint is strictly applicable to scalar and enum // types, with message types not being supported. // // “`proto // message MyRepeated { // // repeated value must contain unique items // repeated string value = 1 [(buf.validate.field).repeated.unique = true]; // } // “` Unique *bool `protobuf:"varint,3,opt,name=unique,proto3,oneof" json:"unique,omitempty"` // `items` details the constraints to be applied to each item // in the field. Even for repeated message fields, validation is executed // against each item unless skip is explicitly specified. // // “`proto // // message MyRepeated { // // The items in the field `value` must follow the specified constraints. // repeated string value = 1 [(buf.validate.field).repeated.items = { // string: { // min_len: 3 // max_len: 10 // } // }]; // } Items *FieldConstraints `protobuf:"bytes,4,opt,name=items,proto3,oneof" json:"items,omitempty"` // contains filtered or unexported fields }
RepeatedRules describe the constraints applied to `repeated` values.
func (*RepeatedRules) Descriptor
deprecated
func (*RepeatedRules) Descriptor() ([]byte, []int)
Deprecated: Use RepeatedRules.ProtoReflect.Descriptor instead.
func (*RepeatedRules) GetItems ¶
func (x *RepeatedRules) GetItems() *FieldConstraints
func (*RepeatedRules) GetMaxItems ¶
func (x *RepeatedRules) GetMaxItems() uint64
func (*RepeatedRules) GetMinItems ¶
func (x *RepeatedRules) GetMinItems() uint64
func (*RepeatedRules) GetUnique ¶
func (x *RepeatedRules) GetUnique() bool
func (*RepeatedRules) ProtoMessage ¶
func (*RepeatedRules) ProtoMessage()
func (*RepeatedRules) ProtoReflect ¶
func (x *RepeatedRules) ProtoReflect() protoreflect.Message
func (*RepeatedRules) Reset ¶
func (x *RepeatedRules) Reset()
func (*RepeatedRules) String ¶
func (x *RepeatedRules) String() string
type SFixed32Rules ¶
type SFixed32Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MySFixed32 { // // value must equal 42 // sfixed32 value = 1 [(buf.validate.field).sfixed32.const = 42]; // } // // “` Const *int32 `protobuf:"fixed32,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified value, // an error message is generated. // // “`proto // // message MySFixed32 { // // value must be less than 10 // sfixed32 value = 1 [(buf.validate.field).sfixed32.lt = 10]; // } // // “` Lt *int32 `protobuf:"fixed32,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MySFixed32 { // // value must be less than or equal to 10 // sfixed32 value = 1 [(buf.validate.field).sfixed32.lte = 10]; // } // // “` Lte *int32 `protobuf:"fixed32,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MySFixed32 { // // value must be greater than 5 [sfixed32.gt] // sfixed32 value = 1 [(buf.validate.field).sfixed32.gt = 5]; // // // value must be greater than 5 and less than 10 [sfixed32.gt_lt] // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [sfixed32.gt_lt_exclusive] // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gt: 10, lt: 5 }]; // } // // “` Gt *int32 `protobuf:"fixed32,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MySFixed32 { // // value must be greater than or equal to 5 [sfixed32.gte] // sfixed32 value = 1 [(buf.validate.field).sfixed32.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [sfixed32.gte_lt] // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [sfixed32.gte_lt_exclusive] // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gte: 10, lt: 5 }]; // } // // “` Gte *int32 `protobuf:"fixed32,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MySFixed32 { // // value must be in list [1, 2, 3] // repeated sfixed32 value = 1 (buf.validate.field).sfixed32 = { in: [1, 2, 3] }; // } // // “` In []int32 `protobuf:"fixed32,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MySFixed32 { // // value must not be in list [1, 2, 3] // repeated sfixed32 value = 1 (buf.validate.field).sfixed32 = { not_in: [1, 2, 3] }; // } // // “` NotIn []int32 `protobuf:"fixed32,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
SFixed32Rules describes the constraints applied to `fixed32` values.
func (*SFixed32Rules) Descriptor
deprecated
func (*SFixed32Rules) Descriptor() ([]byte, []int)
Deprecated: Use SFixed32Rules.ProtoReflect.Descriptor instead.
func (*SFixed32Rules) GetConst ¶
func (x *SFixed32Rules) GetConst() int32
func (*SFixed32Rules) GetGt ¶
func (x *SFixed32Rules) GetGt() int32
func (*SFixed32Rules) GetGte ¶
func (x *SFixed32Rules) GetGte() int32
func (*SFixed32Rules) GetIn ¶
func (x *SFixed32Rules) GetIn() []int32
func (*SFixed32Rules) GetLt ¶
func (x *SFixed32Rules) GetLt() int32
func (*SFixed32Rules) GetLte ¶
func (x *SFixed32Rules) GetLte() int32
func (*SFixed32Rules) GetNotIn ¶
func (x *SFixed32Rules) GetNotIn() []int32
func (*SFixed32Rules) ProtoMessage ¶
func (*SFixed32Rules) ProtoMessage()
func (*SFixed32Rules) ProtoReflect ¶
func (x *SFixed32Rules) ProtoReflect() protoreflect.Message
func (*SFixed32Rules) Reset ¶
func (x *SFixed32Rules) Reset()
func (*SFixed32Rules) String ¶
func (x *SFixed32Rules) String() string
type SFixed64Rules ¶
type SFixed64Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MySFixed64 { // // value must equal 42 // sfixed64 value = 1 [(buf.validate.field).sfixed64.const = 42]; // } // // “` Const *int64 `protobuf:"fixed64,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified value, // an error message is generated. // // “`proto // // message MySFixed64 { // // value must be less than 10 // sfixed64 value = 1 [(buf.validate.field).sfixed64.lt = 10]; // } // // “` Lt *int64 `protobuf:"fixed64,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MySFixed64 { // // value must be less than or equal to 10 // sfixed64 value = 1 [(buf.validate.field).sfixed64.lte = 10]; // } // // “` Lte *int64 `protobuf:"fixed64,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MySFixed64 { // // value must be greater than 5 [sfixed64.gt] // sfixed64 value = 1 [(buf.validate.field).sfixed64.gt = 5]; // // // value must be greater than 5 and less than 10 [sfixed64.gt_lt] // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [sfixed64.gt_lt_exclusive] // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gt: 10, lt: 5 }]; // } // // “` Gt *int64 `protobuf:"fixed64,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MySFixed64 { // // value must be greater than or equal to 5 [sfixed64.gte] // sfixed64 value = 1 [(buf.validate.field).sfixed64.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [sfixed64.gte_lt] // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [sfixed64.gte_lt_exclusive] // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gte: 10, lt: 5 }]; // } // // “` Gte *int64 `protobuf:"fixed64,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MySFixed64 { // // value must be in list [1, 2, 3] // repeated sfixed64 value = 1 (buf.validate.field).sfixed64 = { in: [1, 2, 3] }; // } // // “` In []int64 `protobuf:"fixed64,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MySFixed64 { // // value must not be in list [1, 2, 3] // repeated sfixed64 value = 1 (buf.validate.field).sfixed64 = { not_in: [1, 2, 3] }; // } // // “` NotIn []int64 `protobuf:"fixed64,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
SFixed64Rules describes the constraints applied to `fixed64` values.
func (*SFixed64Rules) Descriptor
deprecated
func (*SFixed64Rules) Descriptor() ([]byte, []int)
Deprecated: Use SFixed64Rules.ProtoReflect.Descriptor instead.
func (*SFixed64Rules) GetConst ¶
func (x *SFixed64Rules) GetConst() int64
func (*SFixed64Rules) GetGt ¶
func (x *SFixed64Rules) GetGt() int64
func (*SFixed64Rules) GetGte ¶
func (x *SFixed64Rules) GetGte() int64
func (*SFixed64Rules) GetIn ¶
func (x *SFixed64Rules) GetIn() []int64
func (*SFixed64Rules) GetLt ¶
func (x *SFixed64Rules) GetLt() int64
func (*SFixed64Rules) GetLte ¶
func (x *SFixed64Rules) GetLte() int64
func (*SFixed64Rules) GetNotIn ¶
func (x *SFixed64Rules) GetNotIn() []int64
func (*SFixed64Rules) ProtoMessage ¶
func (*SFixed64Rules) ProtoMessage()
func (*SFixed64Rules) ProtoReflect ¶
func (x *SFixed64Rules) ProtoReflect() protoreflect.Message
func (*SFixed64Rules) Reset ¶
func (x *SFixed64Rules) Reset()
func (*SFixed64Rules) String ¶
func (x *SFixed64Rules) String() string
type SInt32Rules ¶
type SInt32Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MySInt32 { // // value must equal 42 // sint32 value = 1 [(buf.validate.field).sint32.const = 42]; // } // // “` Const *int32 `protobuf:"zigzag32,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field // < value). If the field value is equal to or greater than the specified // value, an error message is generated. // // “`proto // // message MySInt32 { // // value must be less than 10 // sint32 value = 1 [(buf.validate.field).sint32.lt = 10]; // } // // “` Lt *int32 `protobuf:"zigzag32,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MySInt32 { // // value must be less than or equal to 10 // sint32 value = 1 [(buf.validate.field).sint32.lte = 10]; // } // // “` Lte *int32 `protobuf:"zigzag32,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MySInt32 { // // value must be greater than 5 [sint32.gt] // sint32 value = 1 [(buf.validate.field).sint32.gt = 5]; // // // value must be greater than 5 and less than 10 [sint32.gt_lt] // sint32 other_value = 2 [(buf.validate.field).sint32 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [sint32.gt_lt_exclusive] // sint32 another_value = 3 [(buf.validate.field).sint32 = { gt: 10, lt: 5 }]; // } // // “` Gt *int32 `protobuf:"zigzag32,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MySInt32 { // // value must be greater than or equal to 5 [sint32.gte] // sint32 value = 1 [(buf.validate.field).sint32.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [sint32.gte_lt] // sint32 other_value = 2 [(buf.validate.field).sint32 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [sint32.gte_lt_exclusive] // sint32 another_value = 3 [(buf.validate.field).sint32 = { gte: 10, lt: 5 }]; // } // // “` Gte *int32 `protobuf:"zigzag32,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MySInt32 { // // value must be in list [1, 2, 3] // repeated sint32 value = 1 (buf.validate.field).sint32 = { in: [1, 2, 3] }; // } // // “` In []int32 `protobuf:"zigzag32,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MySInt32 { // // value must not be in list [1, 2, 3] // repeated sint32 value = 1 (buf.validate.field).sint32 = { not_in: [1, 2, 3] }; // } // // “` NotIn []int32 `protobuf:"zigzag32,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
SInt32Rules describes the constraints applied to `sint32` values.
func (*SInt32Rules) Descriptor
deprecated
func (*SInt32Rules) Descriptor() ([]byte, []int)
Deprecated: Use SInt32Rules.ProtoReflect.Descriptor instead.
func (*SInt32Rules) GetConst ¶
func (x *SInt32Rules) GetConst() int32
func (*SInt32Rules) GetGt ¶
func (x *SInt32Rules) GetGt() int32
func (*SInt32Rules) GetGte ¶
func (x *SInt32Rules) GetGte() int32
func (*SInt32Rules) GetIn ¶
func (x *SInt32Rules) GetIn() []int32
func (*SInt32Rules) GetLt ¶
func (x *SInt32Rules) GetLt() int32
func (*SInt32Rules) GetLte ¶
func (x *SInt32Rules) GetLte() int32
func (*SInt32Rules) GetNotIn ¶
func (x *SInt32Rules) GetNotIn() []int32
func (*SInt32Rules) ProtoMessage ¶
func (*SInt32Rules) ProtoMessage()
func (*SInt32Rules) ProtoReflect ¶
func (x *SInt32Rules) ProtoReflect() protoreflect.Message
func (*SInt32Rules) Reset ¶
func (x *SInt32Rules) Reset()
func (*SInt32Rules) String ¶
func (x *SInt32Rules) String() string
type SInt64Rules ¶
type SInt64Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MySInt64 { // // value must equal 42 // sint64 value = 1 [(buf.validate.field).sint64.const = 42]; // } // // “` Const *int64 `protobuf:"zigzag64,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field // < value). If the field value is equal to or greater than the specified // value, an error message is generated. // // “`proto // // message MySInt64 { // // value must be less than 10 // sint64 value = 1 [(buf.validate.field).sint64.lt = 10]; // } // // “` Lt *int64 `protobuf:"zigzag64,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MySInt64 { // // value must be less than or equal to 10 // sint64 value = 1 [(buf.validate.field).sint64.lte = 10]; // } // // “` Lte *int64 `protobuf:"zigzag64,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MySInt64 { // // value must be greater than 5 [sint64.gt] // sint64 value = 1 [(buf.validate.field).sint64.gt = 5]; // // // value must be greater than 5 and less than 10 [sint64.gt_lt] // sint64 other_value = 2 [(buf.validate.field).sint64 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [sint64.gt_lt_exclusive] // sint64 another_value = 3 [(buf.validate.field).sint64 = { gt: 10, lt: 5 }]; // } // // “` Gt *int64 `protobuf:"zigzag64,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MySInt64 { // // value must be greater than or equal to 5 [sint64.gte] // sint64 value = 1 [(buf.validate.field).sint64.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [sint64.gte_lt] // sint64 other_value = 2 [(buf.validate.field).sint64 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [sint64.gte_lt_exclusive] // sint64 another_value = 3 [(buf.validate.field).sint64 = { gte: 10, lt: 5 }]; // } // // “` Gte *int64 `protobuf:"zigzag64,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message // is generated. // // “`proto // // message MySInt64 { // // value must be in list [1, 2, 3] // repeated sint64 value = 1 (buf.validate.field).sint64 = { in: [1, 2, 3] }; // } // // “` In []int64 `protobuf:"zigzag64,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MySInt64 { // // value must not be in list [1, 2, 3] // repeated sint64 value = 1 (buf.validate.field).sint64 = { not_in: [1, 2, 3] }; // } // // “` NotIn []int64 `protobuf:"zigzag64,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
SInt64Rules describes the constraints applied to `sint64` values.
func (*SInt64Rules) Descriptor
deprecated
func (*SInt64Rules) Descriptor() ([]byte, []int)
Deprecated: Use SInt64Rules.ProtoReflect.Descriptor instead.
func (*SInt64Rules) GetConst ¶
func (x *SInt64Rules) GetConst() int64
func (*SInt64Rules) GetGt ¶
func (x *SInt64Rules) GetGt() int64
func (*SInt64Rules) GetGte ¶
func (x *SInt64Rules) GetGte() int64
func (*SInt64Rules) GetIn ¶
func (x *SInt64Rules) GetIn() []int64
func (*SInt64Rules) GetLt ¶
func (x *SInt64Rules) GetLt() int64
func (*SInt64Rules) GetLte ¶
func (x *SInt64Rules) GetLte() int64
func (*SInt64Rules) GetNotIn ¶
func (x *SInt64Rules) GetNotIn() []int64
func (*SInt64Rules) ProtoMessage ¶
func (*SInt64Rules) ProtoMessage()
func (*SInt64Rules) ProtoReflect ¶
func (x *SInt64Rules) ProtoReflect() protoreflect.Message
func (*SInt64Rules) Reset ¶
func (x *SInt64Rules) Reset()
func (*SInt64Rules) String ¶
func (x *SInt64Rules) String() string
type StringRules ¶
type StringRules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MyString { // // value must equal `hello` // string value = 1 [(buf.validate.field).string.const = "hello"]; // } // // “` Const *string `protobuf:"bytes,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `len` dictates that the field value must have the specified // number of characters (Unicode code points), which may differ from the number // of bytes in the string. If the field value does not meet the specified // length, an error message will be generated. // // “`proto // // message MyString { // // value must equal 5 runes // string value = 1 [(buf.validate.field).string.len = 5]; // } // // “` Len *uint64 `protobuf:"varint,19,opt,name=len,proto3,oneof" json:"len,omitempty"` // `min_len` specifies that the field value must have at least the specified // number of characters (Unicode code points), which may differ from the number // of bytes in the string. If the field value contains fewer characters, an error // message will be generated. // // “`proto // // message MyString { // // value length must be at least 3 runes // string value = 1 [(buf.validate.field).string.min_len = 3]; // } // // “` MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen,proto3,oneof" json:"min_len,omitempty"` // `max_len` specifies that the field value must have no more than the specified // number of characters (Unicode code points), which may differ from the // number of bytes in the string. If the field value contains more characters, // an error message will be generated. // // “`proto // // message MyString { // // value length must be at most 10 runes // string value = 1 [(buf.validate.field).string.max_len = 10]; // } // // “` MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen,proto3,oneof" json:"max_len,omitempty"` // `len_bytes` dictates that the field value must have the specified number of // bytes. If the field value does not match the specified length in bytes, // an error message will be generated. // // “`proto // // message MyString { // // value length must be 6 bytes // string value = 1 [(buf.validate.field).string.len_bytes = 6]; // } // // “` LenBytes *uint64 `protobuf:"varint,20,opt,name=len_bytes,json=lenBytes,proto3,oneof" json:"len_bytes,omitempty"` // `min_bytes` specifies that the field value must have at least the specified // number of bytes. If the field value contains fewer bytes, an error message // will be generated. // // “`proto // // message MyString { // // value length must be at least 4 bytes // string value = 1 [(buf.validate.field).string.min_bytes = 4]; // } // // “` MinBytes *uint64 `protobuf:"varint,4,opt,name=min_bytes,json=minBytes,proto3,oneof" json:"min_bytes,omitempty"` // `max_bytes` specifies that the field value must have no more than the // specified number of bytes. If the field value contains more bytes, an // error message will be generated. // // “`proto // // message MyString { // // value length must be at most 8 bytes // string value = 1 [(buf.validate.field).string.max_bytes = 8]; // } // // “` MaxBytes *uint64 `protobuf:"varint,5,opt,name=max_bytes,json=maxBytes,proto3,oneof" json:"max_bytes,omitempty"` // `pattern` specifies that the field value must match the specified // regular expression (RE2 syntax), with the expression provided without any // delimiters. If the field value doesn't match the regular expression, an // error message will be generated. // // “`proto // // message MyString { // // value does not match regex pattern `^[a-zA-Z]//$` // string value = 1 [(buf.validate.field).string.pattern = "^[a-zA-Z]//$"]; // } // // “` Pattern *string `protobuf:"bytes,6,opt,name=pattern,proto3,oneof" json:"pattern,omitempty"` // `prefix` specifies that the field value must have the // specified substring at the beginning of the string. If the field value // doesn't start with the specified prefix, an error message will be // generated. // // “`proto // // message MyString { // // value does not have prefix `pre` // string value = 1 [(buf.validate.field).string.prefix = "pre"]; // } // // “` Prefix *string `protobuf:"bytes,7,opt,name=prefix,proto3,oneof" json:"prefix,omitempty"` // `suffix` specifies that the field value must have the // specified substring at the end of the string. If the field value doesn't // end with the specified suffix, an error message will be generated. // // “`proto // // message MyString { // // value does not have suffix `post` // string value = 1 [(buf.validate.field).string.suffix = "post"]; // } // // “` Suffix *string `protobuf:"bytes,8,opt,name=suffix,proto3,oneof" json:"suffix,omitempty"` // `contains` specifies that the field value must have the // specified substring anywhere in the string. If the field value doesn't // contain the specified substring, an error message will be generated. // // “`proto // // message MyString { // // value does not contain substring `inside`. // string value = 1 [(buf.validate.field).string.contains = "inside"]; // } // // “` Contains *string `protobuf:"bytes,9,opt,name=contains,proto3,oneof" json:"contains,omitempty"` // `not_contains` specifies that the field value must not have the // specified substring anywhere in the string. If the field value contains // the specified substring, an error message will be generated. // // “`proto // // message MyString { // // value contains substring `inside`. // string value = 1 [(buf.validate.field).string.not_contains = "inside"]; // } // // “` NotContains *string `protobuf:"bytes,23,opt,name=not_contains,json=notContains,proto3,oneof" json:"not_contains,omitempty"` // `in` specifies that the field value must be equal to one of the specified // values. If the field value isn't one of the specified values, an error // message will be generated. // // “`proto // // message MyString { // // value must be in list ["apple", "banana"] // repeated string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"]; // } // // “` In []string `protobuf:"bytes,10,rep,name=in,proto3" json:"in,omitempty"` // `not_in` specifies that the field value cannot be equal to any // of the specified values. If the field value is one of the specified values, // an error message will be generated. // “`proto // // message MyString { // // value must not be in list ["orange", "grape"] // repeated string value = 1 [(buf.validate.field).string.not_in = "orange", (buf.validate.field).string.not_in = "grape"]; // } // // “` NotIn []string `protobuf:"bytes,11,rep,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // `WellKnown` rules provide advanced constraints against common string // patterns // // Types that are assignable to WellKnown: // // *StringRules_Email // *StringRules_Hostname // *StringRules_Ip // *StringRules_Ipv4 // *StringRules_Ipv6 // *StringRules_Uri // *StringRules_UriRef // *StringRules_Address // *StringRules_Uuid // *StringRules_WellKnownRegex WellKnown isStringRules_WellKnown `protobuf_oneof:"well_known"` // This applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to // enable strict header validation. By default, this is true, and HTTP header // validations are [RFC-compliant](https://tools.ietf.org/html/rfc7230#section-3). Setting to false will enable looser // validations that only disallow `\r\n\0` characters, which can be used to // bypass header matching rules. // // “`proto // // message MyString { // // The field `value` must have be a valid HTTP headers, but not enforced with strict rules. // string value = 1 [(buf.validate.field).string.strict = false]; // } // // “` Strict *bool `protobuf:"varint,25,opt,name=strict,proto3,oneof" json:"strict,omitempty"` // contains filtered or unexported fields }
StringRules describes the constraints applied to `string` values These rules may also be applied to the `google.protobuf.StringValue` Well-Known-Type.
func (*StringRules) Descriptor
deprecated
func (*StringRules) Descriptor() ([]byte, []int)
Deprecated: Use StringRules.ProtoReflect.Descriptor instead.
func (*StringRules) GetAddress ¶
func (x *StringRules) GetAddress() bool
func (*StringRules) GetConst ¶
func (x *StringRules) GetConst() string
func (*StringRules) GetContains ¶
func (x *StringRules) GetContains() string
func (*StringRules) GetEmail ¶
func (x *StringRules) GetEmail() bool
func (*StringRules) GetHostname ¶
func (x *StringRules) GetHostname() bool
func (*StringRules) GetIn ¶
func (x *StringRules) GetIn() []string
func (*StringRules) GetIp ¶
func (x *StringRules) GetIp() bool
func (*StringRules) GetIpv4 ¶
func (x *StringRules) GetIpv4() bool
func (*StringRules) GetIpv6 ¶
func (x *StringRules) GetIpv6() bool
func (*StringRules) GetLen ¶
func (x *StringRules) GetLen() uint64
func (*StringRules) GetLenBytes ¶
func (x *StringRules) GetLenBytes() uint64
func (*StringRules) GetMaxBytes ¶
func (x *StringRules) GetMaxBytes() uint64
func (*StringRules) GetMaxLen ¶
func (x *StringRules) GetMaxLen() uint64
func (*StringRules) GetMinBytes ¶
func (x *StringRules) GetMinBytes() uint64
func (*StringRules) GetMinLen ¶
func (x *StringRules) GetMinLen() uint64
func (*StringRules) GetNotContains ¶
func (x *StringRules) GetNotContains() string
func (*StringRules) GetNotIn ¶
func (x *StringRules) GetNotIn() []string
func (*StringRules) GetPattern ¶
func (x *StringRules) GetPattern() string
func (*StringRules) GetPrefix ¶
func (x *StringRules) GetPrefix() string
func (*StringRules) GetStrict ¶
func (x *StringRules) GetStrict() bool
func (*StringRules) GetSuffix ¶
func (x *StringRules) GetSuffix() string
func (*StringRules) GetUri ¶
func (x *StringRules) GetUri() bool
func (*StringRules) GetUriRef ¶
func (x *StringRules) GetUriRef() bool
func (*StringRules) GetUuid ¶
func (x *StringRules) GetUuid() bool
func (*StringRules) GetWellKnown ¶
func (m *StringRules) GetWellKnown() isStringRules_WellKnown
func (*StringRules) GetWellKnownRegex ¶
func (x *StringRules) GetWellKnownRegex() KnownRegex
func (*StringRules) ProtoMessage ¶
func (*StringRules) ProtoMessage()
func (*StringRules) ProtoReflect ¶
func (x *StringRules) ProtoReflect() protoreflect.Message
func (*StringRules) Reset ¶
func (x *StringRules) Reset()
func (*StringRules) String ¶
func (x *StringRules) String() string
type StringRules_Address ¶
type StringRules_Address struct { // `address` specifies that the field value must be either a valid hostname // as defined by [RFC 1034](https://tools.ietf.org/html/rfc1034#section-3.5) // (which doesn't support internationalized domain names or IDNs) or a valid // IP (v4 or v6). If the field value isn't a valid hostname or IP, an error // message will be generated. // // “`proto // // message MyString { // // value must be a valid hostname, or ip address // string value = 1 [(buf.validate.field).string.address = true]; // } // // “` Address bool `protobuf:"varint,21,opt,name=address,proto3,oneof"` }
type StringRules_Email ¶
type StringRules_Email struct { // `email` specifies that the field value must be a valid email address // (addr-spec only) as defined by [RFC 5322](https://tools.ietf.org/html/rfc5322#section-3.4.1). // If the field value isn't a valid email address, an error message will be generated. // // “`proto // // message MyString { // // value must be a valid email address // string value = 1 [(buf.validate.field).string.email = true]; // } // // “` Email bool `protobuf:"varint,12,opt,name=email,proto3,oneof"` }
type StringRules_Hostname ¶
type StringRules_Hostname struct { // `hostname` specifies that the field value must be a valid // hostname as defined by [RFC 1034](https://tools.ietf.org/html/rfc1034#section-3.5). This constraint doesn't support // internationalized domain names (IDNs). If the field value isn't a // valid hostname, an error message will be generated. // // “`proto // // message MyString { // // value must be a valid hostname // string value = 1 [(buf.validate.field).string.hostname = true]; // } // // “` Hostname bool `protobuf:"varint,13,opt,name=hostname,proto3,oneof"` }
type StringRules_Ip ¶
type StringRules_Ip struct { // `ip` specifies that the field value must be a valid IP // (v4 or v6) address, without surrounding square brackets for IPv6 addresses. // If the field value isn't a valid IP address, an error message will be // generated. // // “`proto // // message MyString { // // value must be a valid IP address // string value = 1 [(buf.validate.field).string.ip = true]; // } // // “` Ip bool `protobuf:"varint,14,opt,name=ip,proto3,oneof"` }
type StringRules_Ipv4 ¶
type StringRules_Ipv4 struct { // `ipv4` specifies that the field value must be a valid IPv4 // address. If the field value isn't a valid IPv4 address, an error message // will be generated. // // “`proto // // message MyString { // // value must be a valid IPv4 address // string value = 1 [(buf.validate.field).string.ipv4 = true]; // } // // “` Ipv4 bool `protobuf:"varint,15,opt,name=ipv4,proto3,oneof"` }
type StringRules_Ipv6 ¶
type StringRules_Ipv6 struct { // `ipv6` specifies that the field value must be a valid // IPv6 address, without surrounding square brackets. If the field value is // not a valid IPv6 address, an error message will be generated. // // “`proto // // message MyString { // // value must be a valid IPv6 address // string value = 1 [(buf.validate.field).string.ipv6 = true]; // } // // “` Ipv6 bool `protobuf:"varint,16,opt,name=ipv6,proto3,oneof"` }
type StringRules_Uri ¶
type StringRules_Uri struct { // `uri` specifies that the field value must be a valid, // absolute URI as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3). If the field value isn't a valid, // absolute URI, an error message will be generated. // // “`proto // // message MyString { // // value must be a valid URI // string value = 1 [(buf.validate.field).string.uri = true]; // } // // “` Uri bool `protobuf:"varint,17,opt,name=uri,proto3,oneof"` }
type StringRules_UriRef ¶
type StringRules_UriRef struct { // `uri_ref` specifies that the field value must be a valid URI // as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) and may be either relative or absolute. If the // field value isn't a valid URI, an error message will be generated. // // “`proto // // message MyString { // // value must be a valid URI // string value = 1 [(buf.validate.field).string.uri_ref = true]; // } // // “` UriRef bool `protobuf:"varint,18,opt,name=uri_ref,json=uriRef,proto3,oneof"` }
type StringRules_Uuid ¶
type StringRules_Uuid struct { // `uuid` specifies that the field value must be a valid UUID as defined by // [RFC 4122](https://tools.ietf.org/html/rfc4122#section-4.1.2). If the // field value isn't a valid UUID, an error message will be generated. // // “`proto // // message MyString { // // value must be a valid UUID // string value = 1 [(buf.validate.field).string.uuid = true]; // } // // “` Uuid bool `protobuf:"varint,22,opt,name=uuid,proto3,oneof"` }
type StringRules_WellKnownRegex ¶
type StringRules_WellKnownRegex struct { // `well_known_regex` specifies a common well-known pattern // defined as a regex. If the field value doesn't match the well-known // regex, an error message will be generated. // // “`proto // // message MyString { // // value must be a valid HTTP header value // string value = 1 [(buf.validate.field).string.well_known_regex = 2]; // } // // “` // // #### KnownRegex // // `well_known_regex` contains some well-known patterns. // // | Name | Number | Description | // |-------------------------------|--------|-------------------------------------------| // | KNOWN_REGEX_UNSPECIFIED | 0 | | // | KNOWN_REGEX_HTTP_HEADER_NAME | 1 | HTTP header name as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2) | // | KNOWN_REGEX_HTTP_HEADER_VALUE | 2 | HTTP header value as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2.4) | WellKnownRegex KnownRegex `protobuf:"varint,24,opt,name=well_known_regex,json=wellKnownRegex,proto3,enum=buf.validate.KnownRegex,oneof"` }
type TimestampRules ¶
type TimestampRules struct { // `const` dictates that this field, of the `google.protobuf.Timestamp` type, must exactly match the specified value. If the field value doesn't correspond to the specified timestamp, an error message will be generated. // // “`proto // // message MyTimestamp { // // value must equal 2023-05-03T10:00:00Z // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.const = {seconds: 1727998800}]; // } // // “` Const *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=const,proto3,oneof" json:"const,omitempty"` // requires the duration field value to be less than the specified value (field < value). If the field value doesn't meet the required conditions, an error message is generated. // // “`proto // // message MyDuration { // // duration must be less than 'P3D' [duration.lt] // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = { seconds: 259200 }]; // } // // “` Lt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // requires the timestamp field value to be less than or equal to the specified value (field <= value). If the field value doesn't meet the required conditions, an error message is generated. // // “`proto // // message MyTimestamp { // // timestamp must be less than or equal to '2023-05-14T00:00:00Z' [timestamp.lte] // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.lte = { seconds: 1678867200 }]; // } // // “` Lte *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the timestamp field value to be greater than the specified // value (exclusive). If the value of `gt` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyTimestamp { // // timestamp must be greater than '2023-01-01T00:00:00Z' [timestamp.gt] // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gt = { seconds: 1672444800 }]; // // // timestamp must be greater than '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' [timestamp.gt_lt] // google.protobuf.Timestamp another_value = 2 [(buf.validate.field).timestamp = { gt: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }]; // // // timestamp must be greater than '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' [timestamp.gt_lt_exclusive] // google.protobuf.Timestamp other_value = 3 [(buf.validate.field).timestamp = { gt: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }]; // } // // “` Gt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the timestamp field value to be greater than or equal to the // specified value (exclusive). If the value of `gte` is larger than a // specified `lt` or `lte`, the range is reversed, and the field value // must be outside the specified range. If the field value doesn't meet // the required conditions, an error message is generated. // // “`proto // // message MyTimestamp { // // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' [timestamp.gte] // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gte = { seconds: 1672444800 }]; // // // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' [timestamp.gte_lt] // google.protobuf.Timestamp another_value = 2 [(buf.validate.field).timestamp = { gte: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }]; // // // timestamp must be greater than or equal to '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' [timestamp.gte_lt_exclusive] // google.protobuf.Timestamp other_value = 3 [(buf.validate.field).timestamp = { gte: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }]; // } // // “` Gte *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `lt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be less than the current time. `lt_now` can only be used with the `within` rule. // // “`proto // // message MyTimestamp { // // value must be less than now // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.lt_now = true]; // } // // “` LtNow *bool `protobuf:"varint,7,opt,name=lt_now,json=ltNow,proto3,oneof" json:"lt_now,omitempty"` // `gt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be greater than the current time. `gt_now` can only be used with the `within` rule. // // “`proto // // message MyTimestamp { // // value must be greater than now // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.gt_now = true]; // } // // “` GtNow *bool `protobuf:"varint,8,opt,name=gt_now,json=gtNow,proto3,oneof" json:"gt_now,omitempty"` // `within` specifies that this field, of the `google.protobuf.Timestamp` type, must be within the specified duration of the current time. If the field value isn't within the duration, an error message is generated. // // “`proto // // message MyTimestamp { // // value must be within 1 hour of now // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.within = {seconds: 3600}]; // } // // “` Within *durationpb.Duration `protobuf:"bytes,9,opt,name=within,proto3,oneof" json:"within,omitempty"` // contains filtered or unexported fields }
TimestampRules describe the constraints applied exclusively to the `google.protobuf.Timestamp` well-known type.
func (*TimestampRules) Descriptor
deprecated
func (*TimestampRules) Descriptor() ([]byte, []int)
Deprecated: Use TimestampRules.ProtoReflect.Descriptor instead.
func (*TimestampRules) GetConst ¶
func (x *TimestampRules) GetConst() *timestamppb.Timestamp
func (*TimestampRules) GetGt ¶
func (x *TimestampRules) GetGt() *timestamppb.Timestamp
func (*TimestampRules) GetGtNow ¶
func (x *TimestampRules) GetGtNow() bool
func (*TimestampRules) GetGte ¶
func (x *TimestampRules) GetGte() *timestamppb.Timestamp
func (*TimestampRules) GetLt ¶
func (x *TimestampRules) GetLt() *timestamppb.Timestamp
func (*TimestampRules) GetLtNow ¶
func (x *TimestampRules) GetLtNow() bool
func (*TimestampRules) GetLte ¶
func (x *TimestampRules) GetLte() *timestamppb.Timestamp
func (*TimestampRules) GetWithin ¶
func (x *TimestampRules) GetWithin() *durationpb.Duration
func (*TimestampRules) ProtoMessage ¶
func (*TimestampRules) ProtoMessage()
func (*TimestampRules) ProtoReflect ¶
func (x *TimestampRules) ProtoReflect() protoreflect.Message
func (*TimestampRules) Reset ¶
func (x *TimestampRules) Reset()
func (*TimestampRules) String ¶
func (x *TimestampRules) String() string
type UInt32Rules ¶
type UInt32Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MyUInt32 { // // value must equal 42 // uint32 value = 1 [(buf.validate.field).uint32.const = 42]; // } // // “` Const *uint32 `protobuf:"varint,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified value, // an error message is generated. // // “`proto // // message MyUInt32 { // // value must be less than 10 // uint32 value = 1 [(buf.validate.field).uint32.lt = 10]; // } // // “` Lt *uint32 `protobuf:"varint,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MyUInt32 { // // value must be less than or equal to 10 // uint32 value = 1 [(buf.validate.field).uint32.lte = 10]; // } // // “` Lte *uint32 `protobuf:"varint,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyUInt32 { // // value must be greater than 5 [uint32.gt] // uint32 value = 1 [(buf.validate.field).uint32.gt = 5]; // // // value must be greater than 5 and less than 10 [uint32.gt_lt] // uint32 other_value = 2 [(buf.validate.field).uint32 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [uint32.gt_lt_exclusive] // uint32 another_value = 3 [(buf.validate.field).uint32 = { gt: 10, lt: 5 }]; // } // // “` Gt *uint32 `protobuf:"varint,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyUInt32 { // // value must be greater than or equal to 5 [uint32.gte] // uint32 value = 1 [(buf.validate.field).uint32.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [uint32.gte_lt] // uint32 other_value = 2 [(buf.validate.field).uint32 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [uint32.gte_lt_exclusive] // uint32 another_value = 3 [(buf.validate.field).uint32 = { gte: 10, lt: 5 }]; // } // // “` Gte *uint32 `protobuf:"varint,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MyUInt32 { // // value must be in list [1, 2, 3] // repeated uint32 value = 1 (buf.validate.field).uint32 = { in: [1, 2, 3] }; // } // // “` In []uint32 `protobuf:"varint,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MyUInt32 { // // value must not be in list [1, 2, 3] // repeated uint32 value = 1 (buf.validate.field).uint32 = { not_in: [1, 2, 3] }; // } // // “` NotIn []uint32 `protobuf:"varint,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
UInt32Rules describes the constraints applied to `uint32` values. These rules may also be applied to the `google.protobuf.UInt32Value` Well-Known-Type.
func (*UInt32Rules) Descriptor
deprecated
func (*UInt32Rules) Descriptor() ([]byte, []int)
Deprecated: Use UInt32Rules.ProtoReflect.Descriptor instead.
func (*UInt32Rules) GetConst ¶
func (x *UInt32Rules) GetConst() uint32
func (*UInt32Rules) GetGt ¶
func (x *UInt32Rules) GetGt() uint32
func (*UInt32Rules) GetGte ¶
func (x *UInt32Rules) GetGte() uint32
func (*UInt32Rules) GetIn ¶
func (x *UInt32Rules) GetIn() []uint32
func (*UInt32Rules) GetLt ¶
func (x *UInt32Rules) GetLt() uint32
func (*UInt32Rules) GetLte ¶
func (x *UInt32Rules) GetLte() uint32
func (*UInt32Rules) GetNotIn ¶
func (x *UInt32Rules) GetNotIn() []uint32
func (*UInt32Rules) ProtoMessage ¶
func (*UInt32Rules) ProtoMessage()
func (*UInt32Rules) ProtoReflect ¶
func (x *UInt32Rules) ProtoReflect() protoreflect.Message
func (*UInt32Rules) Reset ¶
func (x *UInt32Rules) Reset()
func (*UInt32Rules) String ¶
func (x *UInt32Rules) String() string
type UInt64Rules ¶
type UInt64Rules struct { // `const` requires the field value to exactly match the specified value. If // the field value doesn't match, an error message is generated. // // “`proto // // message MyUInt64 { // // value must equal 42 // uint64 value = 1 [(buf.validate.field).uint64.const = 42]; // } // // “` Const *uint64 `protobuf:"varint,1,opt,name=const,proto3,oneof" json:"const,omitempty"` // `lt` requires the field value to be less than the specified value (field < // value). If the field value is equal to or greater than the specified value, // an error message is generated. // // “`proto // // message MyUInt64 { // // value must be less than 10 // uint64 value = 1 [(buf.validate.field).uint64.lt = 10]; // } // // “` Lt *uint64 `protobuf:"varint,2,opt,name=lt,proto3,oneof" json:"lt,omitempty"` // `lte` requires the field value to be less than or equal to the specified // value (field <= value). If the field value is greater than the specified // value, an error message is generated. // // “`proto // // message MyUInt64 { // // value must be less than or equal to 10 // uint64 value = 1 [(buf.validate.field).uint64.lte = 10]; // } // // “` Lte *uint64 `protobuf:"varint,3,opt,name=lte,proto3,oneof" json:"lte,omitempty"` // `gt` requires the field value to be greater than the specified value // (exclusive). If the value of `gt` is larger than a specified `lt` or // `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyUInt64 { // // value must be greater than 5 [uint64.gt] // uint64 value = 1 [(buf.validate.field).uint64.gt = 5]; // // // value must be greater than 5 and less than 10 [uint64.gt_lt] // uint64 other_value = 2 [(buf.validate.field).uint64 = { gt: 5, lt: 10 }]; // // // value must be greater than 10 or less than 5 [uint64.gt_lt_exclusive] // uint64 another_value = 3 [(buf.validate.field).uint64 = { gt: 10, lt: 5 }]; // } // // “` Gt *uint64 `protobuf:"varint,4,opt,name=gt,proto3,oneof" json:"gt,omitempty"` // `gte` requires the field value to be greater than or equal to the specified // value (exclusive). If the value of `gte` is larger than a specified `lt` // or `lte`, the range is reversed, and the field value must be outside the // specified range. If the field value doesn't meet the required conditions, // an error message is generated. // // “`proto // // message MyUInt64 { // // value must be greater than or equal to 5 [uint64.gte] // uint64 value = 1 [(buf.validate.field).uint64.gte = 5]; // // // value must be greater than or equal to 5 and less than 10 [uint64.gte_lt] // uint64 other_value = 2 [(buf.validate.field).uint64 = { gte: 5, lt: 10 }]; // // // value must be greater than or equal to 10 or less than 5 [uint64.gte_lt_exclusive] // uint64 another_value = 3 [(buf.validate.field).uint64 = { gte: 10, lt: 5 }]; // } // // “` Gte *uint64 `protobuf:"varint,5,opt,name=gte,proto3,oneof" json:"gte,omitempty"` // `in` requires the field value to be equal to one of the specified values. // If the field value isn't one of the specified values, an error message is // generated. // // “`proto // // message MyUInt64 { // // value must be in list [1, 2, 3] // repeated uint64 value = 1 (buf.validate.field).uint64 = { in: [1, 2, 3] }; // } // // “` In []uint64 `protobuf:"varint,6,rep,packed,name=in,proto3" json:"in,omitempty"` // `not_in` requires the field value to not be equal to any of the specified // values. If the field value is one of the specified values, an error // message is generated. // // “`proto // // message MyUInt64 { // // value must not be in list [1, 2, 3] // repeated uint64 value = 1 (buf.validate.field).uint64 = { not_in: [1, 2, 3] }; // } // // “` NotIn []uint64 `protobuf:"varint,7,rep,packed,name=not_in,json=notIn,proto3" json:"not_in,omitempty"` // contains filtered or unexported fields }
UInt64Rules describes the constraints applied to `uint64` values. These rules may also be applied to the `google.protobuf.UInt64Value` Well-Known-Type.
func (*UInt64Rules) Descriptor
deprecated
func (*UInt64Rules) Descriptor() ([]byte, []int)
Deprecated: Use UInt64Rules.ProtoReflect.Descriptor instead.
func (*UInt64Rules) GetConst ¶
func (x *UInt64Rules) GetConst() uint64
func (*UInt64Rules) GetGt ¶
func (x *UInt64Rules) GetGt() uint64
func (*UInt64Rules) GetGte ¶
func (x *UInt64Rules) GetGte() uint64
func (*UInt64Rules) GetIn ¶
func (x *UInt64Rules) GetIn() []uint64
func (*UInt64Rules) GetLt ¶
func (x *UInt64Rules) GetLt() uint64
func (*UInt64Rules) GetLte ¶
func (x *UInt64Rules) GetLte() uint64
func (*UInt64Rules) GetNotIn ¶
func (x *UInt64Rules) GetNotIn() []uint64
func (*UInt64Rules) ProtoMessage ¶
func (*UInt64Rules) ProtoMessage()
func (*UInt64Rules) ProtoReflect ¶
func (x *UInt64Rules) ProtoReflect() protoreflect.Message
func (*UInt64Rules) Reset ¶
func (x *UInt64Rules) Reset()
func (*UInt64Rules) String ¶
func (x *UInt64Rules) String() string
type Violation ¶
type Violation struct { // `field_path` is a machine-readable identifier that points to the specific field that failed the validation. // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. FieldPath string `protobuf:"bytes,1,opt,name=field_path,json=fieldPath,proto3" json:"field_path,omitempty"` // `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. // This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated. ConstraintId string `protobuf:"bytes,2,opt,name=constraint_id,json=constraintId,proto3" json:"constraint_id,omitempty"` // `message` is a human-readable error message that describes the nature of the violation. // This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation. Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
`Violation` represents a single instance where a validation rule, expressed as a `Constraint`, was not met. It provides information about the field that caused the violation, the specific constraint that wasn't fulfilled, and a human-readable error message.
```json
{ "fieldPath": "bar", "constraintId": "foo.bar", "message": "bar must be greater than 0" }
```
func (*Violation) Descriptor
deprecated
func (*Violation) GetConstraintId ¶
func (*Violation) GetFieldPath ¶
func (*Violation) GetMessage ¶
func (*Violation) ProtoMessage ¶
func (*Violation) ProtoMessage()
func (*Violation) ProtoReflect ¶
func (x *Violation) ProtoReflect() protoreflect.Message
type Violations ¶
type Violations struct { // `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected. Violations []*Violation `protobuf:"bytes,1,rep,name=violations,proto3" json:"violations,omitempty"` // contains filtered or unexported fields }
`Violations` is a collection of `Violation` messages. This message type is returned by protovalidate when a proto message fails to meet the requirements set by the `Constraint` validation rules. Each individual violation is represented by a `Violation` message.
func (*Violations) Descriptor
deprecated
func (*Violations) Descriptor() ([]byte, []int)
Deprecated: Use Violations.ProtoReflect.Descriptor instead.
func (*Violations) GetViolations ¶
func (x *Violations) GetViolations() []*Violation
func (*Violations) ProtoMessage ¶
func (*Violations) ProtoMessage()
func (*Violations) ProtoReflect ¶
func (x *Violations) ProtoReflect() protoreflect.Message
func (*Violations) Reset ¶
func (x *Violations) Reset()
func (*Violations) String ¶
func (x *Violations) String() string