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) GetExample() [][]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 (x *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 DoubleRules
- func (*DoubleRules) Descriptor() ([]byte, []int)deprecated
- func (x *DoubleRules) GetConst() float64
- func (x *DoubleRules) GetExample() []float64
- func (x *DoubleRules) GetFinite() bool
- func (x *DoubleRules) GetGreaterThan() isDoubleRules_GreaterThan
- func (x *DoubleRules) GetGt() float64
- func (x *DoubleRules) GetGte() float64
- func (x *DoubleRules) GetIn() []float64
- func (x *DoubleRules) GetLessThan() isDoubleRules_LessThan
- 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 DoubleRules_Gt
- type DoubleRules_Gte
- type DoubleRules_Lt
- type DoubleRules_Lte
- type DurationRules
- func (*DurationRules) Descriptor() ([]byte, []int)deprecated
- func (x *DurationRules) GetConst() *durationpb.Duration
- func (x *DurationRules) GetExample() []*durationpb.Duration
- func (x *DurationRules) GetGreaterThan() isDurationRules_GreaterThan
- func (x *DurationRules) GetGt() *durationpb.Duration
- func (x *DurationRules) GetGte() *durationpb.Duration
- func (x *DurationRules) GetIn() []*durationpb.Duration
- func (x *DurationRules) GetLessThan() isDurationRules_LessThan
- 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 DurationRules_Gt
- type DurationRules_Gte
- type DurationRules_Lt
- type DurationRules_Lte
- type EnumRules
- func (*EnumRules) Descriptor() ([]byte, []int)deprecated
- func (x *EnumRules) GetConst() int32
- func (x *EnumRules) GetDefinedOnly() bool
- func (x *EnumRules) GetExample() []int32
- 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 FieldPath
- type FieldPathElement
- func (*FieldPathElement) Descriptor() ([]byte, []int)deprecated
- func (x *FieldPathElement) GetBoolKey() bool
- func (x *FieldPathElement) GetFieldName() string
- func (x *FieldPathElement) GetFieldNumber() int32
- func (x *FieldPathElement) GetFieldType() descriptorpb.FieldDescriptorProto_Type
- func (x *FieldPathElement) GetIndex() uint64
- func (x *FieldPathElement) GetIntKey() int64
- func (x *FieldPathElement) GetKeyType() descriptorpb.FieldDescriptorProto_Type
- func (x *FieldPathElement) GetStringKey() string
- func (x *FieldPathElement) GetSubscript() isFieldPathElement_Subscript
- func (x *FieldPathElement) GetUintKey() uint64
- func (x *FieldPathElement) GetValueType() descriptorpb.FieldDescriptorProto_Type
- func (*FieldPathElement) ProtoMessage()
- func (x *FieldPathElement) ProtoReflect() protoreflect.Message
- func (x *FieldPathElement) Reset()
- func (x *FieldPathElement) String() string
- type FieldPathElement_BoolKey
- type FieldPathElement_Index
- type FieldPathElement_IntKey
- type FieldPathElement_StringKey
- type FieldPathElement_UintKey
- type FieldRules
- func (*FieldRules) Descriptor() ([]byte, []int)deprecated
- func (x *FieldRules) GetAny() *AnyRules
- func (x *FieldRules) GetBool() *BoolRules
- func (x *FieldRules) GetBytes() *BytesRules
- func (x *FieldRules) GetCel() []*Rule
- func (x *FieldRules) GetDouble() *DoubleRules
- func (x *FieldRules) GetDuration() *DurationRules
- func (x *FieldRules) GetEnum() *EnumRules
- func (x *FieldRules) GetFixed32() *Fixed32Rules
- func (x *FieldRules) GetFixed64() *Fixed64Rules
- func (x *FieldRules) GetFloat() *FloatRules
- func (x *FieldRules) GetIgnore() Ignore
- func (x *FieldRules) GetInt32() *Int32Rules
- func (x *FieldRules) GetInt64() *Int64Rules
- func (x *FieldRules) GetMap() *MapRules
- func (x *FieldRules) GetRepeated() *RepeatedRules
- func (x *FieldRules) GetRequired() bool
- func (x *FieldRules) GetSfixed32() *SFixed32Rules
- func (x *FieldRules) GetSfixed64() *SFixed64Rules
- func (x *FieldRules) GetSint32() *SInt32Rules
- func (x *FieldRules) GetSint64() *SInt64Rules
- func (x *FieldRules) GetString_() *StringRules
- func (x *FieldRules) GetTimestamp() *TimestampRules
- func (x *FieldRules) GetType() isFieldRules_Type
- func (x *FieldRules) GetUint32() *UInt32Rules
- func (x *FieldRules) GetUint64() *UInt64Rules
- func (*FieldRules) ProtoMessage()
- func (x *FieldRules) ProtoReflect() protoreflect.Message
- func (x *FieldRules) Reset()
- func (x *FieldRules) String() string
- type FieldRules_Any
- type FieldRules_Bool
- type FieldRules_Bytes
- type FieldRules_Double
- type FieldRules_Duration
- type FieldRules_Enum
- type FieldRules_Fixed32
- type FieldRules_Fixed64
- type FieldRules_Float
- type FieldRules_Int32
- type FieldRules_Int64
- type FieldRules_Map
- type FieldRules_Repeated
- type FieldRules_Sfixed32
- type FieldRules_Sfixed64
- type FieldRules_Sint32
- type FieldRules_Sint64
- type FieldRules_String_
- type FieldRules_Timestamp
- type FieldRules_Uint32
- type FieldRules_Uint64
- type Fixed32Rules
- func (*Fixed32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *Fixed32Rules) GetConst() uint32
- func (x *Fixed32Rules) GetExample() []uint32
- func (x *Fixed32Rules) GetGreaterThan() isFixed32Rules_GreaterThan
- func (x *Fixed32Rules) GetGt() uint32
- func (x *Fixed32Rules) GetGte() uint32
- func (x *Fixed32Rules) GetIn() []uint32
- func (x *Fixed32Rules) GetLessThan() isFixed32Rules_LessThan
- 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 Fixed32Rules_Gt
- type Fixed32Rules_Gte
- type Fixed32Rules_Lt
- type Fixed32Rules_Lte
- type Fixed64Rules
- func (*Fixed64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *Fixed64Rules) GetConst() uint64
- func (x *Fixed64Rules) GetExample() []uint64
- func (x *Fixed64Rules) GetGreaterThan() isFixed64Rules_GreaterThan
- func (x *Fixed64Rules) GetGt() uint64
- func (x *Fixed64Rules) GetGte() uint64
- func (x *Fixed64Rules) GetIn() []uint64
- func (x *Fixed64Rules) GetLessThan() isFixed64Rules_LessThan
- 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 Fixed64Rules_Gt
- type Fixed64Rules_Gte
- type Fixed64Rules_Lt
- type Fixed64Rules_Lte
- type FloatRules
- func (*FloatRules) Descriptor() ([]byte, []int)deprecated
- func (x *FloatRules) GetConst() float32
- func (x *FloatRules) GetExample() []float32
- func (x *FloatRules) GetFinite() bool
- func (x *FloatRules) GetGreaterThan() isFloatRules_GreaterThan
- func (x *FloatRules) GetGt() float32
- func (x *FloatRules) GetGte() float32
- func (x *FloatRules) GetIn() []float32
- func (x *FloatRules) GetLessThan() isFloatRules_LessThan
- 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 FloatRules_Gt
- type FloatRules_Gte
- type FloatRules_Lt
- type FloatRules_Lte
- type Ignore
- func (Ignore) Descriptor() protoreflect.EnumDescriptor
- func (x Ignore) Enum() *Ignore
- func (Ignore) EnumDescriptor() ([]byte, []int)deprecated
- func (x Ignore) Number() protoreflect.EnumNumber
- func (x Ignore) String() string
- func (Ignore) Type() protoreflect.EnumType
- func (x *Ignore) UnmarshalJSON(b []byte) errordeprecated
- type Int32Rules
- func (*Int32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *Int32Rules) GetConst() int32
- func (x *Int32Rules) GetExample() []int32
- func (x *Int32Rules) GetGreaterThan() isInt32Rules_GreaterThan
- func (x *Int32Rules) GetGt() int32
- func (x *Int32Rules) GetGte() int32
- func (x *Int32Rules) GetIn() []int32
- func (x *Int32Rules) GetLessThan() isInt32Rules_LessThan
- 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 Int32Rules_Gt
- type Int32Rules_Gte
- type Int32Rules_Lt
- type Int32Rules_Lte
- type Int64Rules
- func (*Int64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *Int64Rules) GetConst() int64
- func (x *Int64Rules) GetExample() []int64
- func (x *Int64Rules) GetGreaterThan() isInt64Rules_GreaterThan
- func (x *Int64Rules) GetGt() int64
- func (x *Int64Rules) GetGte() int64
- func (x *Int64Rules) GetIn() []int64
- func (x *Int64Rules) GetLessThan() isInt64Rules_LessThan
- 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 Int64Rules_Gt
- type Int64Rules_Gte
- type Int64Rules_Lt
- type Int64Rules_Lte
- type KnownRegex
- func (KnownRegex) Descriptor() protoreflect.EnumDescriptor
- func (x KnownRegex) Enum() *KnownRegex
- func (KnownRegex) EnumDescriptor() ([]byte, []int)deprecated
- func (x KnownRegex) Number() protoreflect.EnumNumber
- func (x KnownRegex) String() string
- func (KnownRegex) Type() protoreflect.EnumType
- func (x *KnownRegex) UnmarshalJSON(b []byte) errordeprecated
- type MapRules
- func (*MapRules) Descriptor() ([]byte, []int)deprecated
- func (x *MapRules) GetKeys() *FieldRules
- func (x *MapRules) GetMaxPairs() uint64
- func (x *MapRules) GetMinPairs() uint64
- func (x *MapRules) GetValues() *FieldRules
- func (*MapRules) ProtoMessage()
- func (x *MapRules) ProtoReflect() protoreflect.Message
- func (x *MapRules) Reset()
- func (x *MapRules) String() string
- type MessageOneofRule
- func (*MessageOneofRule) Descriptor() ([]byte, []int)deprecated
- func (x *MessageOneofRule) GetFields() []string
- func (x *MessageOneofRule) GetRequired() bool
- func (*MessageOneofRule) ProtoMessage()
- func (x *MessageOneofRule) ProtoReflect() protoreflect.Message
- func (x *MessageOneofRule) Reset()
- func (x *MessageOneofRule) String() string
- type MessageRules
- func (*MessageRules) Descriptor() ([]byte, []int)deprecated
- func (x *MessageRules) GetCel() []*Rule
- func (x *MessageRules) GetOneof() []*MessageOneofRule
- func (*MessageRules) ProtoMessage()
- func (x *MessageRules) ProtoReflect() protoreflect.Message
- func (x *MessageRules) Reset()
- func (x *MessageRules) String() string
- type OneofRules
- type PredefinedRules
- type RepeatedRules
- func (*RepeatedRules) Descriptor() ([]byte, []int)deprecated
- func (x *RepeatedRules) GetItems() *FieldRules
- 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 Rule
- type SFixed32Rules
- func (*SFixed32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *SFixed32Rules) GetConst() int32
- func (x *SFixed32Rules) GetExample() []int32
- func (x *SFixed32Rules) GetGreaterThan() isSFixed32Rules_GreaterThan
- func (x *SFixed32Rules) GetGt() int32
- func (x *SFixed32Rules) GetGte() int32
- func (x *SFixed32Rules) GetIn() []int32
- func (x *SFixed32Rules) GetLessThan() isSFixed32Rules_LessThan
- 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 SFixed32Rules_Gt
- type SFixed32Rules_Gte
- type SFixed32Rules_Lt
- type SFixed32Rules_Lte
- type SFixed64Rules
- func (*SFixed64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *SFixed64Rules) GetConst() int64
- func (x *SFixed64Rules) GetExample() []int64
- func (x *SFixed64Rules) GetGreaterThan() isSFixed64Rules_GreaterThan
- func (x *SFixed64Rules) GetGt() int64
- func (x *SFixed64Rules) GetGte() int64
- func (x *SFixed64Rules) GetIn() []int64
- func (x *SFixed64Rules) GetLessThan() isSFixed64Rules_LessThan
- 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 SFixed64Rules_Gt
- type SFixed64Rules_Gte
- type SFixed64Rules_Lt
- type SFixed64Rules_Lte
- type SInt32Rules
- func (*SInt32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *SInt32Rules) GetConst() int32
- func (x *SInt32Rules) GetExample() []int32
- func (x *SInt32Rules) GetGreaterThan() isSInt32Rules_GreaterThan
- func (x *SInt32Rules) GetGt() int32
- func (x *SInt32Rules) GetGte() int32
- func (x *SInt32Rules) GetIn() []int32
- func (x *SInt32Rules) GetLessThan() isSInt32Rules_LessThan
- 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 SInt32Rules_Gt
- type SInt32Rules_Gte
- type SInt32Rules_Lt
- type SInt32Rules_Lte
- type SInt64Rules
- func (*SInt64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *SInt64Rules) GetConst() int64
- func (x *SInt64Rules) GetExample() []int64
- func (x *SInt64Rules) GetGreaterThan() isSInt64Rules_GreaterThan
- func (x *SInt64Rules) GetGt() int64
- func (x *SInt64Rules) GetGte() int64
- func (x *SInt64Rules) GetIn() []int64
- func (x *SInt64Rules) GetLessThan() isSInt64Rules_LessThan
- 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 SInt64Rules_Gt
- type SInt64Rules_Gte
- type SInt64Rules_Lt
- type SInt64Rules_Lte
- 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) GetExample() []string
- func (x *StringRules) GetHostAndPort() bool
- func (x *StringRules) GetHostname() bool
- func (x *StringRules) GetIn() []string
- func (x *StringRules) GetIp() bool
- func (x *StringRules) GetIpPrefix() bool
- func (x *StringRules) GetIpWithPrefixlen() bool
- func (x *StringRules) GetIpv4() bool
- func (x *StringRules) GetIpv4Prefix() bool
- func (x *StringRules) GetIpv4WithPrefixlen() bool
- func (x *StringRules) GetIpv6() bool
- func (x *StringRules) GetIpv6Prefix() bool
- func (x *StringRules) GetIpv6WithPrefixlen() 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) GetTuuid() bool
- func (x *StringRules) GetUri() bool
- func (x *StringRules) GetUriRef() bool
- func (x *StringRules) GetUuid() bool
- func (x *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_HostAndPort
- type StringRules_Hostname
- type StringRules_Ip
- type StringRules_IpPrefix
- type StringRules_IpWithPrefixlen
- type StringRules_Ipv4
- type StringRules_Ipv4Prefix
- type StringRules_Ipv4WithPrefixlen
- type StringRules_Ipv6
- type StringRules_Ipv6Prefix
- type StringRules_Ipv6WithPrefixlen
- type StringRules_Tuuid
- 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) GetExample() []*timestamppb.Timestamp
- func (x *TimestampRules) GetGreaterThan() isTimestampRules_GreaterThan
- func (x *TimestampRules) GetGt() *timestamppb.Timestamp
- func (x *TimestampRules) GetGtNow() bool
- func (x *TimestampRules) GetGte() *timestamppb.Timestamp
- func (x *TimestampRules) GetLessThan() isTimestampRules_LessThan
- 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 TimestampRules_Gt
- type TimestampRules_GtNow
- type TimestampRules_Gte
- type TimestampRules_Lt
- type TimestampRules_LtNow
- type TimestampRules_Lte
- type UInt32Rules
- func (*UInt32Rules) Descriptor() ([]byte, []int)deprecated
- func (x *UInt32Rules) GetConst() uint32
- func (x *UInt32Rules) GetExample() []uint32
- func (x *UInt32Rules) GetGreaterThan() isUInt32Rules_GreaterThan
- func (x *UInt32Rules) GetGt() uint32
- func (x *UInt32Rules) GetGte() uint32
- func (x *UInt32Rules) GetIn() []uint32
- func (x *UInt32Rules) GetLessThan() isUInt32Rules_LessThan
- 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 UInt32Rules_Gt
- type UInt32Rules_Gte
- type UInt32Rules_Lt
- type UInt32Rules_Lte
- type UInt64Rules
- func (*UInt64Rules) Descriptor() ([]byte, []int)deprecated
- func (x *UInt64Rules) GetConst() uint64
- func (x *UInt64Rules) GetExample() []uint64
- func (x *UInt64Rules) GetGreaterThan() isUInt64Rules_GreaterThan
- func (x *UInt64Rules) GetGt() uint64
- func (x *UInt64Rules) GetGte() uint64
- func (x *UInt64Rules) GetIn() []uint64
- func (x *UInt64Rules) GetLessThan() isUInt64Rules_LessThan
- 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 UInt64Rules_Gt
- type UInt64Rules_Gte
- type UInt64Rules_Lt
- type UInt64Rules_Lte
- type Violation
- func (*Violation) Descriptor() ([]byte, []int)deprecated
- func (x *Violation) GetField() *FieldPath
- func (x *Violation) GetForKey() bool
- func (x *Violation) GetMessage() string
- func (x *Violation) GetRule() *FieldPath
- func (x *Violation) GetRuleId() 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 ( Ignore_name = map[int32]string{ 0: "IGNORE_UNSPECIFIED", 1: "IGNORE_IF_ZERO_VALUE", 3: "IGNORE_ALWAYS", } Ignore_value = map[string]int32{ "IGNORE_UNSPECIFIED": 0, "IGNORE_IF_ZERO_VALUE": 1, "IGNORE_ALWAYS": 3, } )
Enum value maps for Ignore.
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.FieldRules field = 1159; E_Field = &file_buf_validate_validate_proto_extTypes[2] // Specifies predefined rules. When extending a standard rule message, // this adds additional CEL expressions that apply when the extension is used. // // “`proto // // extend buf.validate.Int32Rules { // bool is_zero [(buf.validate.predefined).cel = { // id: "int32.is_zero", // message: "value must be zero", // expression: "!rule || this == 0", // }]; // } // // message Foo { // int32 reserved = 1 [(buf.validate.field).int32.(is_zero) = true]; // } // // “` // // optional buf.validate.PredefinedRules predefined = 1160; E_Predefined = &file_buf_validate_validate_proto_extTypes[3] )
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.MessageRules message = 1159; 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.OneofRules oneof = 1159; E_Oneof = &file_buf_validate_validate_proto_extTypes[1] )
Extension fields to descriptorpb.OneofOptions.
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" 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 `value` field 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" json:"not_in,omitempty"` // contains filtered or unexported fields }
AnyRules describe rules 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" json:"const,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyBool { // bool value = 1 [ // (buf.validate.field).bool.example = 1, // (buf.validate.field).bool.example = 2 // ]; // } // // “` Example []bool `protobuf:"varint,2,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
BoolRules describes the rules applied to `bool` values. These rules may also be applied to the `google.protobuf.BoolValue` Well-Known-Type.
func (*BoolRules) Descriptor
deprecated
func (*BoolRules) GetExample ¶ added in v0.8.1
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" 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" 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 length 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" 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" 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 regex 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" 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" 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" 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" 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" 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" json:"not_in,omitempty"` // WellKnown rules provide advanced rules against common byte // patterns // // Types that are valid to be assigned to WellKnown: // // *BytesRules_Ip // *BytesRules_Ipv4 // *BytesRules_Ipv6 WellKnown isBytesRules_WellKnown `protobuf_oneof:"well_known"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyBytes { // bytes value = 1 [ // (buf.validate.field).bytes.example = "\x01\x02", // (buf.validate.field).bytes.example = "\x02\x03" // ]; // } // // “` Example [][]byte `protobuf:"bytes,14,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
BytesRules describe the rules 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) GetExample ¶ added in v0.8.1
func (x *BytesRules) GetExample() [][]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 (x *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 rule, 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,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 rule, 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,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 rule, 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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *DoubleRules_Lt // *DoubleRules_Lte LessThan isDoubleRules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *DoubleRules_Gt // *DoubleRules_Gte GreaterThan isDoubleRules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // double value = 1 [(buf.validate.field).double = { in: [1.0, 2.0, 3.0] }]; // } // // “` In []float64 `protobuf:"fixed64,6,rep,name=in" 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] // double value = 1 [(buf.validate.field).double = { not_in: [1.0, 2.0, 3.0] }]; // } // // “` NotIn []float64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `finite` requires the field value to be finite. If the field value is // infinite or NaN, an error message is generated. Finite *bool `protobuf:"varint,8,opt,name=finite" json:"finite,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyDouble { // double value = 1 [ // (buf.validate.field).double.example = 1.0, // (buf.validate.field).double.example = inf // ]; // } // // “` Example []float64 `protobuf:"fixed64,9,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
DoubleRules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *DoubleRules) GetExample() []float64
func (*DoubleRules) GetFinite ¶ added in v0.2.4
func (x *DoubleRules) GetFinite() bool
func (*DoubleRules) GetGreaterThan ¶ added in v0.3.0
func (x *DoubleRules) GetGreaterThan() isDoubleRules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *DoubleRules) GetLessThan() isDoubleRules_LessThan
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 DoubleRules_Gt ¶ added in v0.3.0
type DoubleRules_Gt struct { // `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,oneof"` }
type DoubleRules_Gte ¶ added in v0.3.0
type DoubleRules_Gte struct { // `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,oneof"` }
type DoubleRules_Lt ¶ added in v0.3.0
type DoubleRules_Lt struct { // `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,oneof"` }
type DoubleRules_Lte ¶ added in v0.3.0
type DoubleRules_Lte struct { // `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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *DurationRules_Lt // *DurationRules_Lte LessThan isDurationRules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *DurationRules_Gt // *DurationRules_Gte GreaterThan isDurationRules_GreaterThan `protobuf_oneof:"greater_than"` // `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" 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" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyDuration { // google.protobuf.Duration value = 1 [ // (buf.validate.field).duration.example = { seconds: 1 }, // (buf.validate.field).duration.example = { seconds: 2 }, // ]; // } // // “` Example []*durationpb.Duration `protobuf:"bytes,9,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
DurationRules describe the rules 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) GetExample ¶ added in v0.8.1
func (x *DurationRules) GetExample() []*durationpb.Duration
func (*DurationRules) GetGreaterThan ¶ added in v0.3.0
func (x *DurationRules) GetGreaterThan() isDurationRules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *DurationRules) GetLessThan() isDurationRules_LessThan
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 DurationRules_Gt ¶ added in v0.3.0
type DurationRules_Gt struct { // `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,oneof"` }
type DurationRules_Gte ¶ added in v0.3.0
type DurationRules_Gte struct { // `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,oneof"` }
type DurationRules_Lt ¶ added in v0.3.0
type DurationRules_Lt struct { // `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,oneof"` }
type DurationRules_Lte ¶ added in v0.3.0
type DurationRules_Lte struct { // `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,oneof"` }
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" 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" 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,name=in" 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,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // enum MyEnum { // MY_ENUM_UNSPECIFIED = 0; // MY_ENUM_VALUE1 = 1; // MY_ENUM_VALUE2 = 2; // } // // message MyMessage { // (buf.validate.field).enum.example = 1, // (buf.validate.field).enum.example = 2 // } // // “` Example []int32 `protobuf:"varint,5,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
EnumRules describe the rules applied to `enum` values.
func (*EnumRules) Descriptor
deprecated
func (*EnumRules) GetDefinedOnly ¶
func (*EnumRules) GetExample ¶ added in v0.8.1
func (*EnumRules) ProtoMessage ¶
func (*EnumRules) ProtoMessage()
func (*EnumRules) ProtoReflect ¶
func (x *EnumRules) ProtoReflect() protoreflect.Message
type FieldPath ¶ added in v0.9.0
type FieldPath struct { // `elements` contains each element of the path, starting from the root and recursing downward. Elements []*FieldPathElement `protobuf:"bytes,1,rep,name=elements" json:"elements,omitempty"` // contains filtered or unexported fields }
`FieldPath` provides a path to a nested protobuf field.
This message provides enough information to render a dotted field path even without protobuf descriptors. It also provides enough information to resolve a nested field through unknown wire data.
func (*FieldPath) Descriptor
deprecated
added in
v0.9.0
func (*FieldPath) GetElements ¶ added in v0.9.0
func (x *FieldPath) GetElements() []*FieldPathElement
func (*FieldPath) ProtoMessage ¶ added in v0.9.0
func (*FieldPath) ProtoMessage()
func (*FieldPath) ProtoReflect ¶ added in v0.9.0
func (x *FieldPath) ProtoReflect() protoreflect.Message
type FieldPathElement ¶ added in v0.9.0
type FieldPathElement struct { // `field_number` is the field number this path element refers to. FieldNumber *int32 `protobuf:"varint,1,opt,name=field_number,json=fieldNumber" json:"field_number,omitempty"` // `field_name` contains the field name this path element refers to. // This can be used to display a human-readable path even if the field number is unknown. FieldName *string `protobuf:"bytes,2,opt,name=field_name,json=fieldName" json:"field_name,omitempty"` // `field_type` specifies the type of this field. When using reflection, this value is not needed. // // This value is provided to make it possible to traverse unknown fields through wire data. // When traversing wire data, be mindful of both packed[1] and delimited[2] encoding schemes. // // N.B.: Although groups are deprecated, the corresponding delimited encoding scheme is not, and // can be explicitly used in Protocol Buffers 2023 Edition. // // [1]: https://protobuf.dev/programming-guides/encoding/#packed // [2]: https://protobuf.dev/programming-guides/encoding/#groups FieldType *descriptorpb.FieldDescriptorProto_Type `` /* 129-byte string literal not displayed */ // `key_type` specifies the map key type of this field. This value is useful when traversing // unknown fields through wire data: specifically, it allows handling the differences between // different integer encodings. KeyType *descriptorpb.FieldDescriptorProto_Type `protobuf:"varint,4,opt,name=key_type,json=keyType,enum=google.protobuf.FieldDescriptorProto_Type" json:"key_type,omitempty"` // `value_type` specifies map value type of this field. This is useful if you want to display a // value inside unknown fields through wire data. ValueType *descriptorpb.FieldDescriptorProto_Type `` /* 129-byte string literal not displayed */ // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. // // Types that are valid to be assigned to Subscript: // // *FieldPathElement_Index // *FieldPathElement_BoolKey // *FieldPathElement_IntKey // *FieldPathElement_UintKey // *FieldPathElement_StringKey Subscript isFieldPathElement_Subscript `protobuf_oneof:"subscript"` // contains filtered or unexported fields }
`FieldPathElement` provides enough information to nest through a single protobuf field.
If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. A path that refers to a value nested under a map key or repeated field index will have a `subscript` value. The `field_type` field allows unambiguous resolution of a field even if descriptors are not available.
func (*FieldPathElement) Descriptor
deprecated
added in
v0.9.0
func (*FieldPathElement) Descriptor() ([]byte, []int)
Deprecated: Use FieldPathElement.ProtoReflect.Descriptor instead.
func (*FieldPathElement) GetBoolKey ¶ added in v0.9.0
func (x *FieldPathElement) GetBoolKey() bool
func (*FieldPathElement) GetFieldName ¶ added in v0.9.0
func (x *FieldPathElement) GetFieldName() string
func (*FieldPathElement) GetFieldNumber ¶ added in v0.9.0
func (x *FieldPathElement) GetFieldNumber() int32
func (*FieldPathElement) GetFieldType ¶ added in v0.9.0
func (x *FieldPathElement) GetFieldType() descriptorpb.FieldDescriptorProto_Type
func (*FieldPathElement) GetIndex ¶ added in v0.9.0
func (x *FieldPathElement) GetIndex() uint64
func (*FieldPathElement) GetIntKey ¶ added in v0.9.0
func (x *FieldPathElement) GetIntKey() int64
func (*FieldPathElement) GetKeyType ¶ added in v0.9.0
func (x *FieldPathElement) GetKeyType() descriptorpb.FieldDescriptorProto_Type
func (*FieldPathElement) GetStringKey ¶ added in v0.9.0
func (x *FieldPathElement) GetStringKey() string
func (*FieldPathElement) GetSubscript ¶ added in v0.9.0
func (x *FieldPathElement) GetSubscript() isFieldPathElement_Subscript
func (*FieldPathElement) GetUintKey ¶ added in v0.9.0
func (x *FieldPathElement) GetUintKey() uint64
func (*FieldPathElement) GetValueType ¶ added in v0.9.0
func (x *FieldPathElement) GetValueType() descriptorpb.FieldDescriptorProto_Type
func (*FieldPathElement) ProtoMessage ¶ added in v0.9.0
func (*FieldPathElement) ProtoMessage()
func (*FieldPathElement) ProtoReflect ¶ added in v0.9.0
func (x *FieldPathElement) ProtoReflect() protoreflect.Message
func (*FieldPathElement) Reset ¶ added in v0.9.0
func (x *FieldPathElement) Reset()
func (*FieldPathElement) String ¶ added in v0.9.0
func (x *FieldPathElement) String() string
type FieldPathElement_BoolKey ¶ added in v0.9.0
type FieldPathElement_BoolKey struct { // `bool_key` specifies a map key of type bool. BoolKey bool `protobuf:"varint,7,opt,name=bool_key,json=boolKey,oneof"` }
type FieldPathElement_Index ¶ added in v0.9.0
type FieldPathElement_Index struct { // `index` specifies a 0-based index into a repeated field. Index uint64 `protobuf:"varint,6,opt,name=index,oneof"` }
type FieldPathElement_IntKey ¶ added in v0.9.0
type FieldPathElement_IntKey struct { // `int_key` specifies a map key of type int32, int64, sint32, sint64, sfixed32 or sfixed64. IntKey int64 `protobuf:"varint,8,opt,name=int_key,json=intKey,oneof"` }
type FieldPathElement_StringKey ¶ added in v0.9.0
type FieldPathElement_StringKey struct { // `string_key` specifies a map key of type string. StringKey string `protobuf:"bytes,10,opt,name=string_key,json=stringKey,oneof"` }
type FieldPathElement_UintKey ¶ added in v0.9.0
type FieldPathElement_UintKey struct { // `uint_key` specifies a map key of type uint32, uint64, fixed32 or fixed64. UintKey uint64 `protobuf:"varint,9,opt,name=uint_key,json=uintKey,oneof"` }
type FieldRules ¶ added in v0.11.0
type FieldRules struct { // `cel` is a repeated field used to represent a textual expression // in the Common Expression Language (CEL) syntax. For more information, // [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). // // “`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 []*Rule `protobuf:"bytes,23,rep,name=cel" json:"cel,omitempty"` // If `required` is true, the field must be set. A validation error is returned // if the field is not set. // // “`proto // syntax="proto3"; // // message FieldsWithPresence { // // Requires any string to be set, including the empty string. // optional string link = 1 [ // (buf.validate.field).required = true // ]; // // Requires true or false to be set. // optional bool disabled = 2 [ // (buf.validate.field).required = true // ]; // // Requires a message to be set, including the empty message. // SomeMessage msg = 4 [ // (buf.validate.field).required = true // ]; // } // // “` // // All fields in the example above track presence. By default, Protovalidate // ignores rules on those fields if no value is set. `required` ensures that // the fields are set and valid. // // Fields that don't track presence are always validated by Protovalidate, // whether they are set or not. It is not necessary to add `required`: // // “`proto // syntax="proto3"; // // message FieldsWithoutPresence { // // `string.email` always applies, even to an empty string. // string link = 1 [ // (buf.validate.field).string.email = true // ]; // // `repeated.min_items` always applies, even to an empty list. // repeated string labels = 4 [ // (buf.validate.field).repeated.min_items = 1 // ]; // } // // “` // // To learn which fields track presence, see the // [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). // // Note: While field rules can be applied to repeated items, map keys, and map // values, the elements are always considered to be set. Consequently, // specifying `repeated.items.required` is redundant. Required *bool `protobuf:"varint,25,opt,name=required" json:"required,omitempty"` // Ignore validation rules on the field if its value matches the specified // criteria. See the `Ignore` enum for details. // // “`proto // // message UpdateRequest { // // The uri rule only applies if the field is not an empty string. // string url = 1 [ // (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED, // (buf.validate.field).string.uri = true // ]; // } // // “` Ignore *Ignore `protobuf:"varint,27,opt,name=ignore,enum=buf.validate.Ignore" json:"ignore,omitempty"` // Types that are valid to be assigned to Type: // // *FieldRules_Float // *FieldRules_Double // *FieldRules_Int32 // *FieldRules_Int64 // *FieldRules_Uint32 // *FieldRules_Uint64 // *FieldRules_Sint32 // *FieldRules_Sint64 // *FieldRules_Fixed32 // *FieldRules_Fixed64 // *FieldRules_Sfixed32 // *FieldRules_Sfixed64 // *FieldRules_Bool // *FieldRules_String_ // *FieldRules_Bytes // *FieldRules_Enum // *FieldRules_Repeated // *FieldRules_Map // *FieldRules_Any // *FieldRules_Duration // *FieldRules_Timestamp Type isFieldRules_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 (*FieldRules) Descriptor
deprecated
added in
v0.11.0
func (*FieldRules) Descriptor() ([]byte, []int)
Deprecated: Use FieldRules.ProtoReflect.Descriptor instead.
func (*FieldRules) GetAny ¶ added in v0.11.0
func (x *FieldRules) GetAny() *AnyRules
func (*FieldRules) GetBool ¶ added in v0.11.0
func (x *FieldRules) GetBool() *BoolRules
func (*FieldRules) GetBytes ¶ added in v0.11.0
func (x *FieldRules) GetBytes() *BytesRules
func (*FieldRules) GetCel ¶ added in v0.11.0
func (x *FieldRules) GetCel() []*Rule
func (*FieldRules) GetDouble ¶ added in v0.11.0
func (x *FieldRules) GetDouble() *DoubleRules
func (*FieldRules) GetDuration ¶ added in v0.11.0
func (x *FieldRules) GetDuration() *DurationRules
func (*FieldRules) GetEnum ¶ added in v0.11.0
func (x *FieldRules) GetEnum() *EnumRules
func (*FieldRules) GetFixed32 ¶ added in v0.11.0
func (x *FieldRules) GetFixed32() *Fixed32Rules
func (*FieldRules) GetFixed64 ¶ added in v0.11.0
func (x *FieldRules) GetFixed64() *Fixed64Rules
func (*FieldRules) GetFloat ¶ added in v0.11.0
func (x *FieldRules) GetFloat() *FloatRules
func (*FieldRules) GetIgnore ¶ added in v0.11.0
func (x *FieldRules) GetIgnore() Ignore
func (*FieldRules) GetInt32 ¶ added in v0.11.0
func (x *FieldRules) GetInt32() *Int32Rules
func (*FieldRules) GetInt64 ¶ added in v0.11.0
func (x *FieldRules) GetInt64() *Int64Rules
func (*FieldRules) GetMap ¶ added in v0.11.0
func (x *FieldRules) GetMap() *MapRules
func (*FieldRules) GetRepeated ¶ added in v0.11.0
func (x *FieldRules) GetRepeated() *RepeatedRules
func (*FieldRules) GetRequired ¶ added in v0.11.0
func (x *FieldRules) GetRequired() bool
func (*FieldRules) GetSfixed32 ¶ added in v0.11.0
func (x *FieldRules) GetSfixed32() *SFixed32Rules
func (*FieldRules) GetSfixed64 ¶ added in v0.11.0
func (x *FieldRules) GetSfixed64() *SFixed64Rules
func (*FieldRules) GetSint32 ¶ added in v0.11.0
func (x *FieldRules) GetSint32() *SInt32Rules
func (*FieldRules) GetSint64 ¶ added in v0.11.0
func (x *FieldRules) GetSint64() *SInt64Rules
func (*FieldRules) GetString_ ¶ added in v0.11.0
func (x *FieldRules) GetString_() *StringRules
func (*FieldRules) GetTimestamp ¶ added in v0.11.0
func (x *FieldRules) GetTimestamp() *TimestampRules
func (*FieldRules) GetType ¶ added in v0.11.0
func (x *FieldRules) GetType() isFieldRules_Type
func (*FieldRules) GetUint32 ¶ added in v0.11.0
func (x *FieldRules) GetUint32() *UInt32Rules
func (*FieldRules) GetUint64 ¶ added in v0.11.0
func (x *FieldRules) GetUint64() *UInt64Rules
func (*FieldRules) ProtoMessage ¶ added in v0.11.0
func (*FieldRules) ProtoMessage()
func (*FieldRules) ProtoReflect ¶ added in v0.11.0
func (x *FieldRules) ProtoReflect() protoreflect.Message
func (*FieldRules) Reset ¶ added in v0.11.0
func (x *FieldRules) Reset()
func (*FieldRules) String ¶ added in v0.11.0
func (x *FieldRules) String() string
type FieldRules_Any ¶ added in v0.11.0
type FieldRules_Any struct { // Well-Known Field Types Any *AnyRules `protobuf:"bytes,20,opt,name=any,oneof"` }
type FieldRules_Bool ¶ added in v0.11.0
type FieldRules_Bool struct {
Bool *BoolRules `protobuf:"bytes,13,opt,name=bool,oneof"`
}
type FieldRules_Bytes ¶ added in v0.11.0
type FieldRules_Bytes struct {
Bytes *BytesRules `protobuf:"bytes,15,opt,name=bytes,oneof"`
}
type FieldRules_Double ¶ added in v0.11.0
type FieldRules_Double struct {
Double *DoubleRules `protobuf:"bytes,2,opt,name=double,oneof"`
}
type FieldRules_Duration ¶ added in v0.11.0
type FieldRules_Duration struct {
Duration *DurationRules `protobuf:"bytes,21,opt,name=duration,oneof"`
}
type FieldRules_Enum ¶ added in v0.11.0
type FieldRules_Enum struct { // Complex Field Types Enum *EnumRules `protobuf:"bytes,16,opt,name=enum,oneof"` }
type FieldRules_Fixed32 ¶ added in v0.11.0
type FieldRules_Fixed32 struct {
Fixed32 *Fixed32Rules `protobuf:"bytes,9,opt,name=fixed32,oneof"`
}
type FieldRules_Fixed64 ¶ added in v0.11.0
type FieldRules_Fixed64 struct {
Fixed64 *Fixed64Rules `protobuf:"bytes,10,opt,name=fixed64,oneof"`
}
type FieldRules_Float ¶ added in v0.11.0
type FieldRules_Float struct { // Scalar Field Types Float *FloatRules `protobuf:"bytes,1,opt,name=float,oneof"` }
type FieldRules_Int32 ¶ added in v0.11.0
type FieldRules_Int32 struct {
Int32 *Int32Rules `protobuf:"bytes,3,opt,name=int32,oneof"`
}
type FieldRules_Int64 ¶ added in v0.11.0
type FieldRules_Int64 struct {
Int64 *Int64Rules `protobuf:"bytes,4,opt,name=int64,oneof"`
}
type FieldRules_Map ¶ added in v0.11.0
type FieldRules_Map struct {
Map *MapRules `protobuf:"bytes,19,opt,name=map,oneof"`
}
type FieldRules_Repeated ¶ added in v0.11.0
type FieldRules_Repeated struct {
Repeated *RepeatedRules `protobuf:"bytes,18,opt,name=repeated,oneof"`
}
type FieldRules_Sfixed32 ¶ added in v0.11.0
type FieldRules_Sfixed32 struct {
Sfixed32 *SFixed32Rules `protobuf:"bytes,11,opt,name=sfixed32,oneof"`
}
type FieldRules_Sfixed64 ¶ added in v0.11.0
type FieldRules_Sfixed64 struct {
Sfixed64 *SFixed64Rules `protobuf:"bytes,12,opt,name=sfixed64,oneof"`
}
type FieldRules_Sint32 ¶ added in v0.11.0
type FieldRules_Sint32 struct {
Sint32 *SInt32Rules `protobuf:"bytes,7,opt,name=sint32,oneof"`
}
type FieldRules_Sint64 ¶ added in v0.11.0
type FieldRules_Sint64 struct {
Sint64 *SInt64Rules `protobuf:"bytes,8,opt,name=sint64,oneof"`
}
type FieldRules_String_ ¶ added in v0.11.0
type FieldRules_String_ struct {
String_ *StringRules `protobuf:"bytes,14,opt,name=string,oneof"`
}
type FieldRules_Timestamp ¶ added in v0.11.0
type FieldRules_Timestamp struct {
Timestamp *TimestampRules `protobuf:"bytes,22,opt,name=timestamp,oneof"`
}
type FieldRules_Uint32 ¶ added in v0.11.0
type FieldRules_Uint32 struct {
Uint32 *UInt32Rules `protobuf:"bytes,5,opt,name=uint32,oneof"`
}
type FieldRules_Uint64 ¶ added in v0.11.0
type FieldRules_Uint64 struct {
Uint64 *UInt64Rules `protobuf:"bytes,6,opt,name=uint64,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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *Fixed32Rules_Lt // *Fixed32Rules_Lte LessThan isFixed32Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *Fixed32Rules_Gt // *Fixed32Rules_Gte GreaterThan isFixed32Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // fixed32 value = 1 [(buf.validate.field).fixed32 = { in: [1, 2, 3] }]; // } // // “` In []uint32 `protobuf:"fixed32,6,rep,name=in" 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] // fixed32 value = 1 [(buf.validate.field).fixed32 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []uint32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyFixed32 { // fixed32 value = 1 [ // (buf.validate.field).fixed32.example = 1, // (buf.validate.field).fixed32.example = 2 // ]; // } // // “` Example []uint32 `protobuf:"fixed32,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
Fixed32Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *Fixed32Rules) GetExample() []uint32
func (*Fixed32Rules) GetGreaterThan ¶ added in v0.3.0
func (x *Fixed32Rules) GetGreaterThan() isFixed32Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *Fixed32Rules) GetLessThan() isFixed32Rules_LessThan
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 Fixed32Rules_Gt ¶ added in v0.3.0
type Fixed32Rules_Gt struct { // `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,oneof"` }
type Fixed32Rules_Gte ¶ added in v0.3.0
type Fixed32Rules_Gte struct { // `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,oneof"` }
type Fixed32Rules_Lt ¶ added in v0.3.0
type Fixed32Rules_Lt struct { // `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,oneof"` }
type Fixed32Rules_Lte ¶ added in v0.3.0
type Fixed32Rules_Lte struct { // `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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *Fixed64Rules_Lt // *Fixed64Rules_Lte LessThan isFixed64Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *Fixed64Rules_Gt // *Fixed64Rules_Gte GreaterThan isFixed64Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // fixed64 value = 1 [(buf.validate.field).fixed64 = { in: [1, 2, 3] }]; // } // // “` In []uint64 `protobuf:"fixed64,6,rep,name=in" 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] // fixed64 value = 1 [(buf.validate.field).fixed64 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []uint64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyFixed64 { // fixed64 value = 1 [ // (buf.validate.field).fixed64.example = 1, // (buf.validate.field).fixed64.example = 2 // ]; // } // // “` Example []uint64 `protobuf:"fixed64,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
Fixed64Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *Fixed64Rules) GetExample() []uint64
func (*Fixed64Rules) GetGreaterThan ¶ added in v0.3.0
func (x *Fixed64Rules) GetGreaterThan() isFixed64Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *Fixed64Rules) GetLessThan() isFixed64Rules_LessThan
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 Fixed64Rules_Gt ¶ added in v0.3.0
type Fixed64Rules_Gt struct { // `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,oneof"` }
type Fixed64Rules_Gte ¶ added in v0.3.0
type Fixed64Rules_Gte struct { // `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,oneof"` }
type Fixed64Rules_Lt ¶ added in v0.3.0
type Fixed64Rules_Lt struct { // `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,oneof"` }
type Fixed64Rules_Lte ¶ added in v0.3.0
type Fixed64Rules_Lte struct { // `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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *FloatRules_Lt // *FloatRules_Lte LessThan isFloatRules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *FloatRules_Gt // *FloatRules_Gte GreaterThan isFloatRules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // float value = 1 [(buf.validate.field).float = { in: [1.0, 2.0, 3.0] }]; // } // // “` In []float32 `protobuf:"fixed32,6,rep,name=in" 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] // float value = 1 [(buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] }]; // } // // “` NotIn []float32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `finite` requires the field value to be finite. If the field value is // infinite or NaN, an error message is generated. Finite *bool `protobuf:"varint,8,opt,name=finite" json:"finite,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyFloat { // float value = 1 [ // (buf.validate.field).float.example = 1.0, // (buf.validate.field).float.example = inf // ]; // } // // “` Example []float32 `protobuf:"fixed32,9,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
FloatRules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *FloatRules) GetExample() []float32
func (*FloatRules) GetFinite ¶ added in v0.2.4
func (x *FloatRules) GetFinite() bool
func (*FloatRules) GetGreaterThan ¶ added in v0.3.0
func (x *FloatRules) GetGreaterThan() isFloatRules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *FloatRules) GetLessThan() isFloatRules_LessThan
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 FloatRules_Gt ¶ added in v0.3.0
type FloatRules_Gt struct { // `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,oneof"` }
type FloatRules_Gte ¶ added in v0.3.0
type FloatRules_Gte struct { // `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,oneof"` }
type FloatRules_Lt ¶ added in v0.3.0
type FloatRules_Lt struct { // `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,oneof"` }
type FloatRules_Lte ¶ added in v0.3.0
type FloatRules_Lte struct { // `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,oneof"` }
type Ignore ¶ added in v0.5.6
type Ignore int32
Specifies how `FieldRules.ignore` behaves, depending on the field's value, and whether the field tracks presence.
const ( // Ignore rules if the field tracks presence and is unset. This is the default // behavior. // // In proto3, only message fields, members of a Protobuf `oneof`, and fields // with the `optional` label track presence. Consequently, the following fields // are always validated, whether a value is set or not: // // “`proto // syntax="proto3"; // // message RulesApply { // string email = 1 [ // (buf.validate.field).string.email = true // ]; // int32 age = 2 [ // (buf.validate.field).int32.gt = 0 // ]; // repeated string labels = 3 [ // (buf.validate.field).repeated.min_items = 1 // ]; // } // // “` // // In contrast, the following fields track presence, and are only validated if // a value is set: // // “`proto // syntax="proto3"; // // message RulesApplyIfSet { // optional string email = 1 [ // (buf.validate.field).string.email = true // ]; // oneof ref { // string reference = 2 [ // (buf.validate.field).string.uuid = true // ]; // string name = 3 [ // (buf.validate.field).string.min_len = 4 // ]; // } // SomeMessage msg = 4 [ // (buf.validate.field).cel = {/* ... */} // ]; // } // // “` // // To ensure that such a field is set, add the `required` rule. // // To learn which fields track presence, see the // [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). Ignore_IGNORE_UNSPECIFIED Ignore = 0 // Ignore rules if the field is unset, or set to the zero value. // // The zero value depends on the field type: // - For strings, the zero value is the empty string. // - For bytes, the zero value is empty bytes. // - For bool, the zero value is false. // - For numeric types, the zero value is zero. // - For enums, the zero value is the first defined enum value. // - For repeated fields, the zero is an empty list. // - For map fields, the zero is an empty map. // - For message fields, absence of the message (typically a null-value) is considered zero value. // // For fields that track presence (e.g. adding the `optional` label in proto3), // this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`. Ignore_IGNORE_IF_ZERO_VALUE Ignore = 1 // Always ignore rules, including the `required` rule. // // This is useful for ignoring the rules of a referenced message, or to // temporarily ignore rules during development. // // “`proto // // message MyMessage { // // The field's rules will always be ignored, including any validations // // on value's fields. // MyOtherMessage value = 1 [ // (buf.validate.field).ignore = IGNORE_ALWAYS]; // } // // “` Ignore_IGNORE_ALWAYS Ignore = 3 )
func (Ignore) Descriptor ¶ added in v0.5.6
func (Ignore) Descriptor() protoreflect.EnumDescriptor
func (Ignore) EnumDescriptor
deprecated
added in
v0.5.6
func (Ignore) Number ¶ added in v0.5.6
func (x Ignore) Number() protoreflect.EnumNumber
func (Ignore) Type ¶ added in v0.5.6
func (Ignore) Type() protoreflect.EnumType
func (*Ignore) UnmarshalJSON
deprecated
added in
v0.8.1
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *Int32Rules_Lt // *Int32Rules_Lte LessThan isInt32Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *Int32Rules_Gt // *Int32Rules_Gte GreaterThan isInt32Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // int32 value = 1 [(buf.validate.field).int32 = { in: [1, 2, 3] }]; // } // // “` In []int32 `protobuf:"varint,6,rep,name=in" 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] // int32 value = 1 [(buf.validate.field).int32 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []int32 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyInt32 { // int32 value = 1 [ // (buf.validate.field).int32.example = 1, // (buf.validate.field).int32.example = -10 // ]; // } // // “` Example []int32 `protobuf:"varint,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
Int32Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *Int32Rules) GetExample() []int32
func (*Int32Rules) GetGreaterThan ¶ added in v0.3.0
func (x *Int32Rules) GetGreaterThan() isInt32Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *Int32Rules) GetLessThan() isInt32Rules_LessThan
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 Int32Rules_Gt ¶ added in v0.3.0
type Int32Rules_Gt struct { // `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,oneof"` }
type Int32Rules_Gte ¶ added in v0.3.0
type Int32Rules_Gte struct { // `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,oneof"` }
type Int32Rules_Lt ¶ added in v0.3.0
type Int32Rules_Lt struct { // `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,oneof"` }
type Int32Rules_Lte ¶ added in v0.3.0
type Int32Rules_Lte struct { // `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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *Int64Rules_Lt // *Int64Rules_Lte LessThan isInt64Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *Int64Rules_Gt // *Int64Rules_Gte GreaterThan isInt64Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // int64 value = 1 [(buf.validate.field).int64 = { in: [1, 2, 3] }]; // } // // “` In []int64 `protobuf:"varint,6,rep,name=in" 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] // int64 value = 1 [(buf.validate.field).int64 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []int64 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyInt64 { // int64 value = 1 [ // (buf.validate.field).int64.example = 1, // (buf.validate.field).int64.example = -10 // ]; // } // // “` Example []int64 `protobuf:"varint,9,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
Int64Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *Int64Rules) GetExample() []int64
func (*Int64Rules) GetGreaterThan ¶ added in v0.3.0
func (x *Int64Rules) GetGreaterThan() isInt64Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *Int64Rules) GetLessThan() isInt64Rules_LessThan
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 Int64Rules_Gt ¶ added in v0.3.0
type Int64Rules_Gt struct { // `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,oneof"` }
type Int64Rules_Gte ¶ added in v0.3.0
type Int64Rules_Gte struct { // `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,oneof"` }
type Int64Rules_Lt ¶ added in v0.3.0
type Int64Rules_Lt struct { // `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,oneof"` }
type Int64Rules_Lte ¶ added in v0.3.0
type Int64Rules_Lte struct { // `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,oneof"` }
type KnownRegex ¶
type KnownRegex int32
KnownRegex contains some well-known patterns.
const ( KnownRegex_KNOWN_REGEX_UNSPECIFIED KnownRegex = 0 // HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2). KnownRegex_KNOWN_REGEX_HTTP_HEADER_NAME KnownRegex = 1 // HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/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
func (*KnownRegex) UnmarshalJSON
deprecated
added in
v0.8.1
func (x *KnownRegex) UnmarshalJSON(b []byte) error
Deprecated: Do not use.
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" 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" json:"max_pairs,omitempty"` // Specifies the rules to be applied to each key in the field. // // “`proto // // message MyMap { // // The keys in the field `value` must follow the specified rules. // map<string, string> value = 1 [(buf.validate.field).map.keys = { // string: { // min_len: 3 // max_len: 10 // } // }]; // } // // “` // // Note that the `required` rule does not apply. Map keys cannot be unset. Keys *FieldRules `protobuf:"bytes,4,opt,name=keys" json:"keys,omitempty"` // Specifies the rules to be applied to the value of each key in the // field. Message values will still have their validations evaluated unless // `ignore` is specified. // // “`proto // // message MyMap { // // The values in the field `value` must follow the specified rules. // map<string, string> value = 1 [(buf.validate.field).map.values = { // string: { // min_len: 5 // max_len: 20 // } // }]; // } // // “` // Note that the `required` rule does not apply. Map values cannot be unset. Values *FieldRules `protobuf:"bytes,5,opt,name=values" json:"values,omitempty"` // contains filtered or unexported fields }
MapRules describe the rules applied to `map` values.
func (*MapRules) Descriptor
deprecated
func (*MapRules) GetKeys ¶
func (x *MapRules) GetKeys() *FieldRules
func (*MapRules) GetMaxPairs ¶
func (*MapRules) GetMinPairs ¶
func (*MapRules) GetValues ¶
func (x *MapRules) GetValues() *FieldRules
func (*MapRules) ProtoMessage ¶
func (*MapRules) ProtoMessage()
func (*MapRules) ProtoReflect ¶
func (x *MapRules) ProtoReflect() protoreflect.Message
type MessageOneofRule ¶ added in v0.13.0
type MessageOneofRule struct { // A list of field names to include in the oneof. All field names must be // defined in the message. At least one field must be specified, and // duplicates are not permitted. Fields []string `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty"` // If true, one of the fields specified _must_ be set. Required *bool `protobuf:"varint,2,opt,name=required" json:"required,omitempty"` // contains filtered or unexported fields }
func (*MessageOneofRule) Descriptor
deprecated
added in
v0.13.0
func (*MessageOneofRule) Descriptor() ([]byte, []int)
Deprecated: Use MessageOneofRule.ProtoReflect.Descriptor instead.
func (*MessageOneofRule) GetFields ¶ added in v0.13.0
func (x *MessageOneofRule) GetFields() []string
func (*MessageOneofRule) GetRequired ¶ added in v0.13.0
func (x *MessageOneofRule) GetRequired() bool
func (*MessageOneofRule) ProtoMessage ¶ added in v0.13.0
func (*MessageOneofRule) ProtoMessage()
func (*MessageOneofRule) ProtoReflect ¶ added in v0.13.0
func (x *MessageOneofRule) ProtoReflect() protoreflect.Message
func (*MessageOneofRule) Reset ¶ added in v0.13.0
func (x *MessageOneofRule) Reset()
func (*MessageOneofRule) String ¶ added in v0.13.0
func (x *MessageOneofRule) String() string
type MessageRules ¶ added in v0.11.0
type MessageRules struct { // `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message. // These rules are written in Common Expression Language (CEL) syntax. For more information, // [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). // // “`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 []*Rule `protobuf:"bytes,3,rep,name=cel" json:"cel,omitempty"` // `oneof` is a repeated field of type MessageOneofRule that specifies a list of fields // of which at most one can be present. If `required` is also specified, then exactly one // of the specified fields _must_ be present. // // This will enforce oneof-like constraints with a few features not provided by // actual Protobuf oneof declarations: // 1. Repeated and map fields are allowed in this validation. In a Protobuf oneof, // only scalar fields are allowed. // 2. Fields with implicit presence are allowed. In a Protobuf oneof, all member // fields have explicit presence. This means that, for the purpose of determining // how many fields are set, explicitly setting such a field to its zero value is // effectively the same as not setting it at all. // 3. This will always generate validation errors for a message unmarshalled from // serialized data that sets more than one field. With a Protobuf oneof, when // multiple fields are present in the serialized form, earlier values are usually // silently ignored when unmarshalling, with only the last field being set when // unmarshalling completes. // // Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means // only the field that is set will be validated and the unset fields are not validated according to the field rules. // This behavior can be overridden by setting `ignore` against a field. // // “`proto // // message MyMessage { // // Only one of `field1` or `field2` _can_ be present in this message. // option (buf.validate.message).oneof = { fields: ["field1", "field2"] }; // // Exactly one of `field3` or `field4` _must_ be present in this message. // option (buf.validate.message).oneof = { fields: ["field3", "field4"], required: true }; // string field1 = 1; // bytes field2 = 2; // bool field3 = 3; // int32 field4 = 4; // } // // “` Oneof []*MessageOneofRule `protobuf:"bytes,4,rep,name=oneof" json:"oneof,omitempty"` // contains filtered or unexported fields }
MessageRules represents validation rules that are applied to the entire message. It includes disabling options and a list of Rule messages representing Common Expression Language (CEL) validation rules.
func (*MessageRules) Descriptor
deprecated
added in
v0.11.0
func (*MessageRules) Descriptor() ([]byte, []int)
Deprecated: Use MessageRules.ProtoReflect.Descriptor instead.
func (*MessageRules) GetCel ¶ added in v0.11.0
func (x *MessageRules) GetCel() []*Rule
func (*MessageRules) GetOneof ¶ added in v0.13.0
func (x *MessageRules) GetOneof() []*MessageOneofRule
func (*MessageRules) ProtoMessage ¶ added in v0.11.0
func (*MessageRules) ProtoMessage()
func (*MessageRules) ProtoReflect ¶ added in v0.11.0
func (x *MessageRules) ProtoReflect() protoreflect.Message
func (*MessageRules) Reset ¶ added in v0.11.0
func (x *MessageRules) Reset()
func (*MessageRules) String ¶ added in v0.11.0
func (x *MessageRules) String() string
type OneofRules ¶ added in v0.11.0
type OneofRules struct { // If `required` is true, exactly one field of the oneof must be set. A // validation error is returned if no fields in the oneof are set. Further rules // should be placed on the fields themselves to ensure they are valid values, // such as `min_len` or `gt`. // // “`proto // // message MyMessage { // oneof value { // // Either `a` or `b` must be set. If `a` is set, it must also be // // non-empty; whereas if `b` is set, it can still be an empty string. // option (buf.validate.oneof).required = true; // string a = 1 [(buf.validate.field).string.min_len = 1]; // string b = 2; // } // } // // “` Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` // contains filtered or unexported fields }
The `OneofRules` message type enables you to manage rules for oneof fields in your protobuf messages.
func (*OneofRules) Descriptor
deprecated
added in
v0.11.0
func (*OneofRules) Descriptor() ([]byte, []int)
Deprecated: Use OneofRules.ProtoReflect.Descriptor instead.
func (*OneofRules) GetRequired ¶ added in v0.11.0
func (x *OneofRules) GetRequired() bool
func (*OneofRules) ProtoMessage ¶ added in v0.11.0
func (*OneofRules) ProtoMessage()
func (*OneofRules) ProtoReflect ¶ added in v0.11.0
func (x *OneofRules) ProtoReflect() protoreflect.Message
func (*OneofRules) Reset ¶ added in v0.11.0
func (x *OneofRules) Reset()
func (*OneofRules) String ¶ added in v0.11.0
func (x *OneofRules) String() string
type PredefinedRules ¶ added in v0.11.0
type PredefinedRules struct { // `cel` is a repeated field used to represent a textual expression // in the Common Expression Language (CEL) syntax. For more information, // [see our documentation](https://buf.build/docs/protovalidate/schemas/predefined-rules/). // // “`proto // // message MyMessage { // // The field `value` must be greater than 42. // optional int32 value = 1 [(buf.validate.predefined).cel = { // id: "my_message.value", // message: "value must be greater than 42", // expression: "this > 42", // }]; // } // // “` Cel []*Rule `protobuf:"bytes,1,rep,name=cel" json:"cel,omitempty"` // contains filtered or unexported fields }
PredefinedRules are custom rules that can be re-used with multiple fields.
func (*PredefinedRules) Descriptor
deprecated
added in
v0.11.0
func (*PredefinedRules) Descriptor() ([]byte, []int)
Deprecated: Use PredefinedRules.ProtoReflect.Descriptor instead.
func (*PredefinedRules) GetCel ¶ added in v0.11.0
func (x *PredefinedRules) GetCel() []*Rule
func (*PredefinedRules) ProtoMessage ¶ added in v0.11.0
func (*PredefinedRules) ProtoMessage()
func (*PredefinedRules) ProtoReflect ¶ added in v0.11.0
func (x *PredefinedRules) ProtoReflect() protoreflect.Message
func (*PredefinedRules) Reset ¶ added in v0.11.0
func (x *PredefinedRules) Reset()
func (*PredefinedRules) String ¶ added in v0.11.0
func (x *PredefinedRules) String() string
type RepeatedRules ¶
type RepeatedRules struct { // `min_items` requires that this field must contain at least the specified // minimum number of items. // // Note that `min_items = 1` is equivalent to setting a field as `required`. // // “`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" 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" json:"max_items,omitempty"` // `unique` indicates that all elements in this field must // be unique. This rule 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" json:"unique,omitempty"` // `items` details the rules to be applied to each item // in the field. Even for repeated message fields, validation is executed // against each item unless `ignore` is specified. // // “`proto // // message MyRepeated { // // The items in the field `value` must follow the specified rules. // repeated string value = 1 [(buf.validate.field).repeated.items = { // string: { // min_len: 3 // max_len: 10 // } // }]; // } // // “` // // Note that the `required` rule does not apply. Repeated items // cannot be unset. Items *FieldRules `protobuf:"bytes,4,opt,name=items" json:"items,omitempty"` // contains filtered or unexported fields }
RepeatedRules describe the rules 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() *FieldRules
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 Rule ¶ added in v0.11.0
type Rule struct { // `id` is a string that serves as a machine-readable name for this Rule. // It should be unique within its scope, which could be either a message or a field. Id *string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` // `message` is an optional field that provides a human-readable error message // for this Rule 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" 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" json:"expression,omitempty"` // contains filtered or unexported fields }
`Rule` represents a validation rule written in the Common Expression Language (CEL) syntax. Each Rule includes a unique identifier, an optional error message, and the CEL expression to evaluate. For more information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
```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 (*Rule) Descriptor
deprecated
added in
v0.11.0
func (*Rule) GetExpression ¶ added in v0.11.0
func (*Rule) GetMessage ¶ added in v0.11.0
func (*Rule) ProtoMessage ¶ added in v0.11.0
func (*Rule) ProtoMessage()
func (*Rule) ProtoReflect ¶ added in v0.11.0
func (x *Rule) ProtoReflect() protoreflect.Message
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *SFixed32Rules_Lt // *SFixed32Rules_Lte LessThan isSFixed32Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *SFixed32Rules_Gt // *SFixed32Rules_Gte GreaterThan isSFixed32Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // sfixed32 value = 1 [(buf.validate.field).sfixed32 = { in: [1, 2, 3] }]; // } // // “` In []int32 `protobuf:"fixed32,6,rep,name=in" 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] // sfixed32 value = 1 [(buf.validate.field).sfixed32 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []int32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MySFixed32 { // sfixed32 value = 1 [ // (buf.validate.field).sfixed32.example = 1, // (buf.validate.field).sfixed32.example = 2 // ]; // } // // “` Example []int32 `protobuf:"fixed32,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
SFixed32Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *SFixed32Rules) GetExample() []int32
func (*SFixed32Rules) GetGreaterThan ¶ added in v0.3.0
func (x *SFixed32Rules) GetGreaterThan() isSFixed32Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *SFixed32Rules) GetLessThan() isSFixed32Rules_LessThan
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 SFixed32Rules_Gt ¶ added in v0.3.0
type SFixed32Rules_Gt struct { // `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,oneof"` }
type SFixed32Rules_Gte ¶ added in v0.3.0
type SFixed32Rules_Gte struct { // `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,oneof"` }
type SFixed32Rules_Lt ¶ added in v0.3.0
type SFixed32Rules_Lt struct { // `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,oneof"` }
type SFixed32Rules_Lte ¶ added in v0.3.0
type SFixed32Rules_Lte struct { // `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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *SFixed64Rules_Lt // *SFixed64Rules_Lte LessThan isSFixed64Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *SFixed64Rules_Gt // *SFixed64Rules_Gte GreaterThan isSFixed64Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // sfixed64 value = 1 [(buf.validate.field).sfixed64 = { in: [1, 2, 3] }]; // } // // “` In []int64 `protobuf:"fixed64,6,rep,name=in" 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] // sfixed64 value = 1 [(buf.validate.field).sfixed64 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []int64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MySFixed64 { // sfixed64 value = 1 [ // (buf.validate.field).sfixed64.example = 1, // (buf.validate.field).sfixed64.example = 2 // ]; // } // // “` Example []int64 `protobuf:"fixed64,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
SFixed64Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *SFixed64Rules) GetExample() []int64
func (*SFixed64Rules) GetGreaterThan ¶ added in v0.3.0
func (x *SFixed64Rules) GetGreaterThan() isSFixed64Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *SFixed64Rules) GetLessThan() isSFixed64Rules_LessThan
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 SFixed64Rules_Gt ¶ added in v0.3.0
type SFixed64Rules_Gt struct { // `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,oneof"` }
type SFixed64Rules_Gte ¶ added in v0.3.0
type SFixed64Rules_Gte struct { // `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,oneof"` }
type SFixed64Rules_Lt ¶ added in v0.3.0
type SFixed64Rules_Lt struct { // `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,oneof"` }
type SFixed64Rules_Lte ¶ added in v0.3.0
type SFixed64Rules_Lte struct { // `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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *SInt32Rules_Lt // *SInt32Rules_Lte LessThan isSInt32Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *SInt32Rules_Gt // *SInt32Rules_Gte GreaterThan isSInt32Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // sint32 value = 1 [(buf.validate.field).sint32 = { in: [1, 2, 3] }]; // } // // “` In []int32 `protobuf:"zigzag32,6,rep,name=in" 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] // sint32 value = 1 [(buf.validate.field).sint32 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []int32 `protobuf:"zigzag32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MySInt32 { // sint32 value = 1 [ // (buf.validate.field).sint32.example = 1, // (buf.validate.field).sint32.example = -10 // ]; // } // // “` Example []int32 `protobuf:"zigzag32,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
SInt32Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *SInt32Rules) GetExample() []int32
func (*SInt32Rules) GetGreaterThan ¶ added in v0.3.0
func (x *SInt32Rules) GetGreaterThan() isSInt32Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *SInt32Rules) GetLessThan() isSInt32Rules_LessThan
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 SInt32Rules_Gt ¶ added in v0.3.0
type SInt32Rules_Gt struct { // `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,oneof"` }
type SInt32Rules_Gte ¶ added in v0.3.0
type SInt32Rules_Gte struct { // `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,oneof"` }
type SInt32Rules_Lt ¶ added in v0.3.0
type SInt32Rules_Lt struct { // `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,oneof"` }
type SInt32Rules_Lte ¶ added in v0.3.0
type SInt32Rules_Lte struct { // `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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *SInt64Rules_Lt // *SInt64Rules_Lte LessThan isSInt64Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *SInt64Rules_Gt // *SInt64Rules_Gte GreaterThan isSInt64Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // sint64 value = 1 [(buf.validate.field).sint64 = { in: [1, 2, 3] }]; // } // // “` In []int64 `protobuf:"zigzag64,6,rep,name=in" 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] // sint64 value = 1 [(buf.validate.field).sint64 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []int64 `protobuf:"zigzag64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MySInt64 { // sint64 value = 1 [ // (buf.validate.field).sint64.example = 1, // (buf.validate.field).sint64.example = -10 // ]; // } // // “` Example []int64 `protobuf:"zigzag64,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
SInt64Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *SInt64Rules) GetExample() []int64
func (*SInt64Rules) GetGreaterThan ¶ added in v0.3.0
func (x *SInt64Rules) GetGreaterThan() isSInt64Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *SInt64Rules) GetLessThan() isSInt64Rules_LessThan
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 SInt64Rules_Gt ¶ added in v0.3.0
type SInt64Rules_Gt struct { // `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,oneof"` }
type SInt64Rules_Gte ¶ added in v0.3.0
type SInt64Rules_Gte struct { // `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,oneof"` }
type SInt64Rules_Lt ¶ added in v0.3.0
type SInt64Rules_Lt struct { // `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,oneof"` }
type SInt64Rules_Lte ¶ added in v0.3.0
type SInt64Rules_Lte struct { // `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,oneof"` }
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" 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 length must be 5 characters // string value = 1 [(buf.validate.field).string.len = 5]; // } // // “` Len *uint64 `protobuf:"varint,19,opt,name=len" 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 characters // string value = 1 [(buf.validate.field).string.min_len = 3]; // } // // “` MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen" 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 characters // string value = 1 [(buf.validate.field).string.max_len = 10]; // } // // “` MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen" 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" 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" 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" 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" 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" 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" 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" 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" 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"] // string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"]; // } // // “` In []string `protobuf:"bytes,10,rep,name=in" 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"] // 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" json:"not_in,omitempty"` // `WellKnown` rules provide advanced rules against common string // patterns. // // Types that are valid to be assigned to WellKnown: // // *StringRules_Email // *StringRules_Hostname // *StringRules_Ip // *StringRules_Ipv4 // *StringRules_Ipv6 // *StringRules_Uri // *StringRules_UriRef // *StringRules_Address // *StringRules_Uuid // *StringRules_Tuuid // *StringRules_IpWithPrefixlen // *StringRules_Ipv4WithPrefixlen // *StringRules_Ipv6WithPrefixlen // *StringRules_IpPrefix // *StringRules_Ipv4Prefix // *StringRules_Ipv6Prefix // *StringRules_HostAndPort // *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://datatracker.ietf.org/doc/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" json:"strict,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyString { // string value = 1 [ // (buf.validate.field).string.example = "hello", // (buf.validate.field).string.example = "world" // ]; // } // // “` Example []string `protobuf:"bytes,34,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
StringRules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *StringRules) GetExample() []string
func (*StringRules) GetHostAndPort ¶ added in v0.5.6
func (x *StringRules) GetHostAndPort() 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) GetIpPrefix ¶ added in v0.5.0
func (x *StringRules) GetIpPrefix() bool
func (*StringRules) GetIpWithPrefixlen ¶ added in v0.5.0
func (x *StringRules) GetIpWithPrefixlen() bool
func (*StringRules) GetIpv4 ¶
func (x *StringRules) GetIpv4() bool
func (*StringRules) GetIpv4Prefix ¶ added in v0.5.0
func (x *StringRules) GetIpv4Prefix() bool
func (*StringRules) GetIpv4WithPrefixlen ¶ added in v0.5.0
func (x *StringRules) GetIpv4WithPrefixlen() bool
func (*StringRules) GetIpv6 ¶
func (x *StringRules) GetIpv6() bool
func (*StringRules) GetIpv6Prefix ¶ added in v0.5.0
func (x *StringRules) GetIpv6Prefix() bool
func (*StringRules) GetIpv6WithPrefixlen ¶ added in v0.5.0
func (x *StringRules) GetIpv6WithPrefixlen() 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) GetTuuid ¶ added in v0.6.2
func (x *StringRules) GetTuuid() bool
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 (x *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 // (for example, "example.com"), or a valid IP (v4 or v6) address (for example, // "192.168.0.1", or "::1"). 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,oneof"` }
type StringRules_Email ¶
type StringRules_Email struct { // `email` specifies that the field value must be a valid email address, for // example "foo@example.com". // // Conforms to the definition for a valid email address from the [HTML standard](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address). // Note that this standard willfully deviates from [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322), // which allows many unexpected forms of email addresses and will easily match // a typographical error. // // 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,oneof"` }
type StringRules_HostAndPort ¶ added in v0.5.6
type StringRules_HostAndPort struct { // `host_and_port` specifies that the field value must be valid host/port // pair—for example, "example.com:8080". // // The host can be one of: // - An IPv4 address in dotted decimal format—for example, "192.168.5.21". // - An IPv6 address enclosed in square brackets—for example, "[2001:0DB8:ABCD:0012::F1]". // - A hostname—for example, "example.com". // // The port is separated by a colon. It must be non-empty, with a decimal number // in the range of 0-65535, inclusive. HostAndPort bool `protobuf:"varint,32,opt,name=host_and_port,json=hostAndPort,oneof"` }
type StringRules_Hostname ¶
type StringRules_Hostname struct { // `hostname` specifies that the field value must be a valid hostname, for // example "foo.example.com". // // A valid hostname follows the rules below: // - The name consists of one or more labels, separated by a dot ("."). // - Each label can be 1 to 63 alphanumeric characters. // - A label can contain hyphens ("-"), but must not start or end with a hyphen. // - The right-most label must not be digits only. // - The name can have a trailing dot—for example, "foo.example.com.". // - The name can be 253 characters at most, excluding the optional trailing dot. // // 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,oneof"` }
type StringRules_Ip ¶
type StringRules_Ip struct { // `ip` specifies that the field value must be a valid IP (v4 or v6) address. // // IPv4 addresses are expected in the dotted decimal format—for example, "192.168.5.21". // IPv6 addresses are expected in their text representation—for example, "::1", // or "2001:0DB8:ABCD:0012::0". // // Both formats are well-defined in the internet standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). // Zone identifiers for IPv6 addresses (for example, "fe80::a%en1") are supported. // // 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,oneof"` }
type StringRules_IpPrefix ¶ added in v0.5.0
type StringRules_IpPrefix struct { // `ip_prefix` specifies that the field value must be a valid IP (v4 or v6) // prefix—for example, "192.168.0.0/16" or "2001:0DB8:ABCD:0012::0/64". // // The prefix must have all zeros for the unmasked bits. For example, // "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the // prefix, and the remaining 64 bits must be zero. // // If the field value isn't a valid IP prefix, an error message will be // generated. // // “`proto // // message MyString { // // value must be a valid IP prefix // string value = 1 [(buf.validate.field).string.ip_prefix = true]; // } // // “` IpPrefix bool `protobuf:"varint,29,opt,name=ip_prefix,json=ipPrefix,oneof"` }
type StringRules_IpWithPrefixlen ¶ added in v0.5.0
type StringRules_IpWithPrefixlen struct { // `ip_with_prefixlen` specifies that the field value must be a valid IP // (v4 or v6) address with prefix length—for example, "192.168.5.21/16" or // "2001:0DB8:ABCD:0012::F1/64". If the field value isn't a valid IP with // prefix length, an error message will be generated. // // “`proto // // message MyString { // // value must be a valid IP with prefix length // string value = 1 [(buf.validate.field).string.ip_with_prefixlen = true]; // } // // “` IpWithPrefixlen bool `protobuf:"varint,26,opt,name=ip_with_prefixlen,json=ipWithPrefixlen,oneof"` }
type StringRules_Ipv4 ¶
type StringRules_Ipv4 struct { // `ipv4` specifies that the field value must be a valid IPv4 address—for // example "192.168.5.21". 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,oneof"` }
type StringRules_Ipv4Prefix ¶ added in v0.5.0
type StringRules_Ipv4Prefix struct { // `ipv4_prefix` specifies that the field value must be a valid IPv4 // prefix, for example "192.168.0.0/16". // // The prefix must have all zeros for the unmasked bits. For example, // "192.168.0.0/16" designates the left-most 16 bits for the prefix, // and the remaining 16 bits must be zero. // // If the field value isn't a valid IPv4 prefix, an error message // will be generated. // // “`proto // // message MyString { // // value must be a valid IPv4 prefix // string value = 1 [(buf.validate.field).string.ipv4_prefix = true]; // } // // “` Ipv4Prefix bool `protobuf:"varint,30,opt,name=ipv4_prefix,json=ipv4Prefix,oneof"` }
type StringRules_Ipv4WithPrefixlen ¶ added in v0.5.0
type StringRules_Ipv4WithPrefixlen struct { // `ipv4_with_prefixlen` specifies that the field value must be a valid // IPv4 address with prefix length—for example, "192.168.5.21/16". If the // field value isn't a valid IPv4 address with prefix length, an error // message will be generated. // // “`proto // // message MyString { // // value must be a valid IPv4 address with prefix length // string value = 1 [(buf.validate.field).string.ipv4_with_prefixlen = true]; // } // // “` Ipv4WithPrefixlen bool `protobuf:"varint,27,opt,name=ipv4_with_prefixlen,json=ipv4WithPrefixlen,oneof"` }
type StringRules_Ipv6 ¶
type StringRules_Ipv6 struct { // `ipv6` specifies that the field value must be a valid IPv6 address—for // example "::1", or "d7a:115c:a1e0:ab12:4843:cd96:626b:430b". 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,oneof"` }
type StringRules_Ipv6Prefix ¶ added in v0.5.0
type StringRules_Ipv6Prefix struct { // `ipv6_prefix` specifies that the field value must be a valid IPv6 prefix—for // example, "2001:0DB8:ABCD:0012::0/64". // // The prefix must have all zeros for the unmasked bits. For example, // "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the // prefix, and the remaining 64 bits must be zero. // // If the field value is not a valid IPv6 prefix, an error message will be // generated. // // “`proto // // message MyString { // // value must be a valid IPv6 prefix // string value = 1 [(buf.validate.field).string.ipv6_prefix = true]; // } // // “` Ipv6Prefix bool `protobuf:"varint,31,opt,name=ipv6_prefix,json=ipv6Prefix,oneof"` }
type StringRules_Ipv6WithPrefixlen ¶ added in v0.5.0
type StringRules_Ipv6WithPrefixlen struct { // `ipv6_with_prefixlen` specifies that the field value must be a valid // IPv6 address with prefix length—for example, "2001:0DB8:ABCD:0012::F1/64". // If the field value is not a valid IPv6 address with prefix length, // an error message will be generated. // // “`proto // // message MyString { // // value must be a valid IPv6 address prefix length // string value = 1 [(buf.validate.field).string.ipv6_with_prefixlen = true]; // } // // “` Ipv6WithPrefixlen bool `protobuf:"varint,28,opt,name=ipv6_with_prefixlen,json=ipv6WithPrefixlen,oneof"` }
type StringRules_Tuuid ¶ added in v0.6.2
type StringRules_Tuuid struct { // `tuuid` (trimmed UUID) specifies that the field value must be a valid UUID as // defined by [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2) with all dashes // omitted. If the field value isn't a valid UUID without dashes, an error message // will be generated. // // “`proto // // message MyString { // // value must be a valid trimmed UUID // string value = 1 [(buf.validate.field).string.tuuid = true]; // } // // “` Tuuid bool `protobuf:"varint,33,opt,name=tuuid,oneof"` }
type StringRules_Uri ¶
type StringRules_Uri struct { // `uri` specifies that the field value must be a valid URI, for example // "https://example.com/foo/bar?baz=quux#frag". // // URI is defined in the internet standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). // Zone Identifiers in IPv6 address literals are supported ([RFC 6874](https://datatracker.ietf.org/doc/html/rfc6874)). // // 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 = true]; // } // // “` Uri bool `protobuf:"varint,17,opt,name=uri,oneof"` }
type StringRules_UriRef ¶
type StringRules_UriRef struct { // `uri_ref` specifies that the field value must be a valid URI Reference—either // a URI such as "https://example.com/foo/bar?baz=quux#frag", or a Relative // Reference such as "./foo/bar?query". // // URI, URI Reference, and Relative Reference are defined in the internet // standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). Zone // Identifiers in IPv6 address literals are supported ([RFC 6874](https://datatracker.ietf.org/doc/html/rfc6874)). // // If the field value isn't a valid URI Reference, an error message will be // generated. // // “`proto // // message MyString { // // value must be a valid URI Reference // string value = 1 [(buf.validate.field).string.uri_ref = true]; // } // // “` UriRef bool `protobuf:"varint,18,opt,name=uri_ref,json=uriRef,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://datatracker.ietf.org/doc/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,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 = KNOWN_REGEX_HTTP_HEADER_VALUE]; // } // // “` // // #### 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://datatracker.ietf.org/doc/html/rfc7230#section-3.2) | // | KNOWN_REGEX_HTTP_HEADER_VALUE | 2 | HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4) | WellKnownRegex KnownRegex `protobuf:"varint,24,opt,name=well_known_regex,json=wellKnownRegex,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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *TimestampRules_Lt // *TimestampRules_Lte // *TimestampRules_LtNow LessThan isTimestampRules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *TimestampRules_Gt // *TimestampRules_Gte // *TimestampRules_GtNow GreaterThan isTimestampRules_GreaterThan `protobuf_oneof:"greater_than"` // `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" json:"within,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyTimestamp { // google.protobuf.Timestamp value = 1 [ // (buf.validate.field).timestamp.example = { seconds: 1672444800 }, // (buf.validate.field).timestamp.example = { seconds: 1672531200 }, // ]; // } // // “` Example []*timestamppb.Timestamp `protobuf:"bytes,10,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
TimestampRules describe the rules 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) GetExample ¶ added in v0.8.1
func (x *TimestampRules) GetExample() []*timestamppb.Timestamp
func (*TimestampRules) GetGreaterThan ¶ added in v0.3.0
func (x *TimestampRules) GetGreaterThan() isTimestampRules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *TimestampRules) GetLessThan() isTimestampRules_LessThan
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 TimestampRules_Gt ¶ added in v0.3.0
type TimestampRules_Gt struct { // `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,oneof"` }
type TimestampRules_GtNow ¶ added in v0.3.0
type TimestampRules_GtNow struct { // `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,oneof"` }
type TimestampRules_Gte ¶ added in v0.3.0
type TimestampRules_Gte struct { // `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,oneof"` }
type TimestampRules_Lt ¶ added in v0.3.0
type TimestampRules_Lt struct { // 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,oneof"` }
type TimestampRules_LtNow ¶ added in v0.3.0
type TimestampRules_LtNow struct { // `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,oneof"` }
type TimestampRules_Lte ¶ added in v0.3.0
type TimestampRules_Lte struct { // 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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *UInt32Rules_Lt // *UInt32Rules_Lte LessThan isUInt32Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *UInt32Rules_Gt // *UInt32Rules_Gte GreaterThan isUInt32Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // uint32 value = 1 [(buf.validate.field).uint32 = { in: [1, 2, 3] }]; // } // // “` In []uint32 `protobuf:"varint,6,rep,name=in" 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] // uint32 value = 1 [(buf.validate.field).uint32 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []uint32 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyUInt32 { // uint32 value = 1 [ // (buf.validate.field).uint32.example = 1, // (buf.validate.field).uint32.example = 10 // ]; // } // // “` Example []uint32 `protobuf:"varint,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
UInt32Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *UInt32Rules) GetExample() []uint32
func (*UInt32Rules) GetGreaterThan ¶ added in v0.3.0
func (x *UInt32Rules) GetGreaterThan() isUInt32Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *UInt32Rules) GetLessThan() isUInt32Rules_LessThan
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 UInt32Rules_Gt ¶ added in v0.3.0
type UInt32Rules_Gt struct { // `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,oneof"` }
type UInt32Rules_Gte ¶ added in v0.3.0
type UInt32Rules_Gte struct { // `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,oneof"` }
type UInt32Rules_Lt ¶ added in v0.3.0
type UInt32Rules_Lt struct { // `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,oneof"` }
type UInt32Rules_Lte ¶ added in v0.3.0
type UInt32Rules_Lte struct { // `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,oneof"` }
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" json:"const,omitempty"` // Types that are valid to be assigned to LessThan: // // *UInt64Rules_Lt // *UInt64Rules_Lte LessThan isUInt64Rules_LessThan `protobuf_oneof:"less_than"` // Types that are valid to be assigned to GreaterThan: // // *UInt64Rules_Gt // *UInt64Rules_Gte GreaterThan isUInt64Rules_GreaterThan `protobuf_oneof:"greater_than"` // `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] // uint64 value = 1 [(buf.validate.field).uint64 = { in: [1, 2, 3] }]; // } // // “` In []uint64 `protobuf:"varint,6,rep,name=in" 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] // uint64 value = 1 [(buf.validate.field).uint64 = { not_in: [1, 2, 3] }]; // } // // “` NotIn []uint64 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` // `example` specifies values that the field may have. These values SHOULD // conform to other rules. `example` values will not impact validation // but may be used as helpful guidance on how to populate the given field. // // “`proto // // message MyUInt64 { // uint64 value = 1 [ // (buf.validate.field).uint64.example = 1, // (buf.validate.field).uint64.example = -10 // ]; // } // // “` Example []uint64 `protobuf:"varint,8,rep,name=example" json:"example,omitempty"` // contains filtered or unexported fields }
UInt64Rules describes the rules 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) GetExample ¶ added in v0.8.1
func (x *UInt64Rules) GetExample() []uint64
func (*UInt64Rules) GetGreaterThan ¶ added in v0.3.0
func (x *UInt64Rules) GetGreaterThan() isUInt64Rules_GreaterThan
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) GetLessThan ¶ added in v0.3.0
func (x *UInt64Rules) GetLessThan() isUInt64Rules_LessThan
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 UInt64Rules_Gt ¶ added in v0.3.0
type UInt64Rules_Gt struct { // `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,oneof"` }
type UInt64Rules_Gte ¶ added in v0.3.0
type UInt64Rules_Gte struct { // `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,oneof"` }
type UInt64Rules_Lt ¶ added in v0.3.0
type UInt64Rules_Lt struct { // `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,oneof"` }
type UInt64Rules_Lte ¶ added in v0.3.0
type UInt64Rules_Lte struct { // `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,oneof"` }
type Violation ¶
type Violation struct { // `field` is a machine-readable path to the field that failed 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. // // For example, consider the following message: // // “`proto // // message Message { // bool a = 1 [(buf.validate.field).required = true]; // } // // “` // // It could produce the following violation: // // “`textproto // // violation { // field { element { field_number: 1, field_name: "a", field_type: 8 } } // ... // } // // “` Field *FieldPath `protobuf:"bytes,5,opt,name=field" json:"field,omitempty"` // `rule` is a machine-readable path that points to the specific rule that failed validation. // This will be a nested field starting from the FieldRules of the field that failed validation. // For custom rules, this will provide the path of the rule, e.g. `cel[0]`. // // For example, consider the following message: // // “`proto // // message Message { // bool a = 1 [(buf.validate.field).required = true]; // bool b = 2 [(buf.validate.field).cel = { // id: "custom_rule", // expression: "!this ? 'b must be true': ”" // }] // } // // “` // // It could produce the following violations: // // “`textproto // // violation { // rule { element { field_number: 25, field_name: "required", field_type: 8 } } // ... // } // // violation { // rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } // ... // } // // “` Rule *FieldPath `protobuf:"bytes,6,opt,name=rule" json:"rule,omitempty"` // `rule_id` is the unique identifier of the `Rule` that was not fulfilled. // This is the same `id` that was specified in the `Rule` message, allowing easy tracing of which rule was violated. RuleId *string `protobuf:"bytes,2,opt,name=rule_id,json=ruleId" json:"rule_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 `Rule`, or it can be a custom message that gives more context about the violation. Message *string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` // `for_key` indicates whether the violation was caused by a map key, rather than a value. ForKey *bool `protobuf:"varint,4,opt,name=for_key,json=forKey" json:"for_key,omitempty"` // contains filtered or unexported fields }
`Violation` represents a single instance where a validation rule, expressed as a `Rule`, was not met. It provides information about the field that caused the violation, the specific rule that wasn't fulfilled, and a human-readable error message.
For example, consider the following message:
```proto
message User { int32 age = 1 [(buf.validate.field).cel = { id: "user.age", expression: "this < 18 ? 'User must be at least 18 years old' : ''", }]; }
```
It could produce the following violation:
```json
{ "ruleId": "user.age", "message": "User must be at least 18 years old", "field": { "elements": [ { "fieldNumber": 1, "fieldName": "age", "fieldType": "TYPE_INT32" } ] }, "rule": { "elements": [ { "fieldNumber": 23, "fieldName": "cel", "fieldType": "TYPE_MESSAGE", "index": "0" } ] } }
```
func (*Violation) Descriptor
deprecated
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" 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 `Rule` 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