Protorip

validate

Messages

FieldRules encapsulates the rules for each type of field. Depending on the field, the correct set should be used to ensure proper validations.

NameTagTypeLabelDescription
message17MessageRulesoptional
float1FloatRulesoptional

Scalar Field Types

double2DoubleRulesoptional
int323Int32Rulesoptional
int644Int64Rulesoptional
uint325UInt32Rulesoptional
uint646UInt64Rulesoptional
sint327SInt32Rulesoptional
sint648SInt64Rulesoptional
fixed329Fixed32Rulesoptional
fixed6410Fixed64Rulesoptional
sfixed3211SFixed32Rulesoptional
sfixed6412SFixed64Rulesoptional
bool13BoolRulesoptional
string14StringRulesoptional
bytes15BytesRulesoptional
enum16EnumRulesoptional

Complex Field Types

repeated18RepeatedRulesoptional
map19MapRulesoptional
any20AnyRulesoptional

Well-Known Field Types

duration21DurationRulesoptional
timestamp22TimestampRulesoptional

FloatRules describes the constraints applied to float values

NameTagTypeLabelDescription
const1floatoptional

Const specifies that this field must be exactly the specified value

lt2floatoptional

Lt specifies that this field must be less than the specified value, exclusive

lte3floatoptional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4floatoptional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5floatoptional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6floatrepeated

In specifies that this field must be equal to one of the specified values

not_in7floatrepeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

DoubleRules describes the constraints applied to double values

NameTagTypeLabelDescription
const1doubleoptional

Const specifies that this field must be exactly the specified value

lt2doubleoptional

Lt specifies that this field must be less than the specified value, exclusive

lte3doubleoptional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4doubleoptional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5doubleoptional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6doublerepeated

In specifies that this field must be equal to one of the specified values

not_in7doublerepeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

Int32Rules describes the constraints applied to int32 values

NameTagTypeLabelDescription
const1int32optional

Const specifies that this field must be exactly the specified value

lt2int32optional

Lt specifies that this field must be less than the specified value, exclusive

lte3int32optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4int32optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5int32optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6int32repeated

In specifies that this field must be equal to one of the specified values

not_in7int32repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

Int64Rules describes the constraints applied to int64 values

NameTagTypeLabelDescription
const1int64optional

Const specifies that this field must be exactly the specified value

lt2int64optional

Lt specifies that this field must be less than the specified value, exclusive

lte3int64optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4int64optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5int64optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6int64repeated

In specifies that this field must be equal to one of the specified values

not_in7int64repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

UInt32Rules describes the constraints applied to uint32 values

NameTagTypeLabelDescription
const1uint32optional

Const specifies that this field must be exactly the specified value

lt2uint32optional

Lt specifies that this field must be less than the specified value, exclusive

lte3uint32optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4uint32optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5uint32optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6uint32repeated

In specifies that this field must be equal to one of the specified values

not_in7uint32repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

UInt64Rules describes the constraints applied to uint64 values

NameTagTypeLabelDescription
const1uint64optional

Const specifies that this field must be exactly the specified value

lt2uint64optional

Lt specifies that this field must be less than the specified value, exclusive

lte3uint64optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4uint64optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5uint64optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6uint64repeated

In specifies that this field must be equal to one of the specified values

not_in7uint64repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

SInt32Rules describes the constraints applied to sint32 values

NameTagTypeLabelDescription
const1sint32optional

Const specifies that this field must be exactly the specified value

lt2sint32optional

Lt specifies that this field must be less than the specified value, exclusive

lte3sint32optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4sint32optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5sint32optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6sint32repeated

In specifies that this field must be equal to one of the specified values

not_in7sint32repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

SInt64Rules describes the constraints applied to sint64 values

NameTagTypeLabelDescription
const1sint64optional

Const specifies that this field must be exactly the specified value

lt2sint64optional

Lt specifies that this field must be less than the specified value, exclusive

lte3sint64optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4sint64optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5sint64optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6sint64repeated

In specifies that this field must be equal to one of the specified values

not_in7sint64repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

Fixed32Rules describes the constraints applied to fixed32 values

NameTagTypeLabelDescription
const1fixed32optional

Const specifies that this field must be exactly the specified value

lt2fixed32optional

Lt specifies that this field must be less than the specified value, exclusive

lte3fixed32optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4fixed32optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5fixed32optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6fixed32repeated

In specifies that this field must be equal to one of the specified values

not_in7fixed32repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

Fixed64Rules describes the constraints applied to fixed64 values

NameTagTypeLabelDescription
const1fixed64optional

Const specifies that this field must be exactly the specified value

lt2fixed64optional

Lt specifies that this field must be less than the specified value, exclusive

lte3fixed64optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4fixed64optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5fixed64optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6fixed64repeated

In specifies that this field must be equal to one of the specified values

not_in7fixed64repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

SFixed32Rules describes the constraints applied to sfixed32 values

NameTagTypeLabelDescription
const1sfixed32optional

Const specifies that this field must be exactly the specified value

lt2sfixed32optional

Lt specifies that this field must be less than the specified value, exclusive

lte3sfixed32optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4sfixed32optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5sfixed32optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6sfixed32repeated

In specifies that this field must be equal to one of the specified values

not_in7sfixed32repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

SFixed64Rules describes the constraints applied to sfixed64 values

NameTagTypeLabelDescription
const1sfixed64optional

Const specifies that this field must be exactly the specified value

lt2sfixed64optional

Lt specifies that this field must be less than the specified value, exclusive

lte3sfixed64optional

Lte specifies that this field must be less than or equal to the specified value, inclusive

gt4sfixed64optional

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

gte5sfixed64optional

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

in6sfixed64repeated

In specifies that this field must be equal to one of the specified values

not_in7sfixed64repeated

NotIn specifies that this field cannot be equal to one of the specified values

ignore_empty8booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

BoolRules describes the constraints applied to bool values

NameTagTypeLabelDescription
const1booloptional

Const specifies that this field must be exactly the specified value

StringRules describe the constraints applied to string values

NameTagTypeLabelDescription
const1stringoptional

Const specifies that this field must be exactly the specified value

len19uint64optional

Len specifies that this field must be the specified number of characters (Unicode code points). Note that the number of characters may differ from the number of bytes in the string.

min_len2uint64optional

MinLen specifies that this field must be the specified number of characters (Unicode code points) at a minimum. Note that the number of characters may differ from the number of bytes in the string.

max_len3uint64optional

MaxLen specifies that this field must be the specified number of characters (Unicode code points) at a maximum. Note that the number of characters may differ from the number of bytes in the string.

len_bytes20uint64optional

LenBytes specifies that this field must be the specified number of bytes

min_bytes4uint64optional

MinBytes specifies that this field must be the specified number of bytes at a minimum

max_bytes5uint64optional

MaxBytes specifies that this field must be the specified number of bytes at a maximum

pattern6stringoptional

Pattern specifies that this field must match against the specified regular expression (RE2 syntax). The included expression should elide any delimiters.

prefix7stringoptional

Prefix specifies that this field must have the specified substring at the beginning of the string.

suffix8stringoptional

Suffix specifies that this field must have the specified substring at the end of the string.

contains9stringoptional

Contains specifies that this field must have the specified substring anywhere in the string.

not_contains23stringoptional

NotContains specifies that this field cannot have the specified substring anywhere in the string.

in10stringrepeated

In specifies that this field must be equal to one of the specified values

not_in11stringrepeated

NotIn specifies that this field cannot be equal to one of the specified values

email12booloptional

Email specifies that the field must be a valid email address as defined by RFC 5322

hostname13booloptional

Hostname specifies that the field must be a valid hostname as defined by RFC 1034. This constraint does not support internationalized domain names (IDNs).

ip14booloptional

Ip specifies that the field must be a valid IP (v4 or v6) address. Valid IPv6 addresses should not include surrounding square brackets.

ipv415booloptional

Ipv4 specifies that the field must be a valid IPv4 address.

ipv616booloptional

Ipv6 specifies that the field must be a valid IPv6 address. Valid IPv6 addresses should not include surrounding square brackets.

uri17booloptional

Uri specifies that the field must be a valid, absolute URI as defined by RFC 3986

uri_ref18booloptional

UriRef specifies that the field must be a valid URI as defined by RFC 3986 and may be relative or absolute.

address21booloptional

Address specifies that the field must be either a valid hostname as defined by RFC 1034 (which does not support internationalized domain names or IDNs), or it can be a valid IP (v4 or v6).

uuid22booloptional

Uuid specifies that the field must be a valid UUID as defined by RFC 4122

well_known_regex24KnownRegexoptional

WellKnownRegex specifies a common well known pattern defined as a regex.

strict25booloptional

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. Setting to false will enable a looser validations that only disallows \r\n\0 characters, which can be used to bypass header matching rules.

ignore_empty26booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

BytesRules describe the constraints applied to bytes values

NameTagTypeLabelDescription
const1bytesoptional

Const specifies that this field must be exactly the specified value

len13uint64optional

Len specifies that this field must be the specified number of bytes

min_len2uint64optional

MinLen specifies that this field must be the specified number of bytes at a minimum

max_len3uint64optional

MaxLen specifies that this field must be the specified number of bytes at a maximum

pattern4stringoptional

Pattern specifies that this field must match against the specified regular expression (RE2 syntax). The included expression should elide any delimiters.

prefix5bytesoptional

Prefix specifies that this field must have the specified bytes at the beginning of the string.

suffix6bytesoptional

Suffix specifies that this field must have the specified bytes at the end of the string.

contains7bytesoptional

Contains specifies that this field must have the specified bytes anywhere in the string.

in8bytesrepeated

In specifies that this field must be equal to one of the specified values

not_in9bytesrepeated

NotIn specifies that this field cannot be equal to one of the specified values

ip10booloptional

Ip specifies that the field must be a valid IP (v4 or v6) address in byte format

ipv411booloptional

Ipv4 specifies that the field must be a valid IPv4 address in byte format

ipv612booloptional

Ipv6 specifies that the field must be a valid IPv6 address in byte format

ignore_empty14booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

EnumRules describe the constraints applied to enum values

NameTagTypeLabelDescription
const1int32optional

Const specifies that this field must be exactly the specified value

defined_only2booloptional

DefinedOnly specifies that this field must be only one of the defined values for this enum, failing on any undefined value.

in3int32repeated

In specifies that this field must be equal to one of the specified values

not_in4int32repeated

NotIn specifies that this field cannot be equal to one of the specified values

MessageRules describe the constraints applied to embedded message values. For message-type fields, validation is performed recursively.

NameTagTypeLabelDescription
skip1booloptional

Skip specifies that the validation rules of this field should not be evaluated

required2booloptional

Required specifies that this field must be set

RepeatedRules describe the constraints applied to repeated values

NameTagTypeLabelDescription
min_items1uint64optional

MinItems specifies that this field must have the specified number of items at a minimum

max_items2uint64optional

MaxItems specifies that this field must have the specified number of items at a maximum

unique3booloptional

Unique specifies that all elements in this field must be unique. This constraint is only applicable to scalar and enum types (messages are not supported).

items4FieldRulesoptional

Items specifies the constraints to be applied to each item in the field. Repeated message fields will still execute validation against each item unless skip is specified here.

ignore_empty5booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

MapRules describe the constraints applied to map values

NameTagTypeLabelDescription
min_pairs1uint64optional

MinPairs specifies that this field must have the specified number of KVs at a minimum

max_pairs2uint64optional

MaxPairs specifies that this field must have the specified number of KVs at a maximum

no_sparse3booloptional

NoSparse specifies values in this field cannot be unset. This only applies to map's with message value types.

keys4FieldRulesoptional

Keys specifies the constraints to be applied to each key in the field.

values5FieldRulesoptional

Values specifies the constraints to be applied to the value of each key in the field. Message values will still have their validations evaluated unless skip is specified here.

ignore_empty6booloptional

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

AnyRules describe constraints applied exclusively to the google.protobuf.Any well-known type

NameTagTypeLabelDescription
required1booloptional

Required specifies that this field must be set

in2stringrepeated

In specifies that this field's type_url must be equal to one of the specified values.

not_in3stringrepeated

NotIn specifies that this field's type_url must not be equal to any of the specified values.

DurationRules describe the constraints applied exclusively to the google.protobuf.Duration well-known type

NameTagTypeLabelDescription
required1booloptional

Required specifies that this field must be set

const2google.protobuf.Durationoptional

Const specifies that this field must be exactly the specified value

lt3google.protobuf.Durationoptional

Lt specifies that this field must be less than the specified value, exclusive

lte4google.protobuf.Durationoptional

Lt specifies that this field must be less than the specified value, inclusive

gt5google.protobuf.Durationoptional

Gt specifies that this field must be greater than the specified value, exclusive

gte6google.protobuf.Durationoptional

Gte specifies that this field must be greater than the specified value, inclusive

in7google.protobuf.Durationrepeated

In specifies that this field must be equal to one of the specified values

not_in8google.protobuf.Durationrepeated

NotIn specifies that this field cannot be equal to one of the specified values

TimestampRules describe the constraints applied exclusively to the google.protobuf.Timestamp well-known type

NameTagTypeLabelDescription
required1booloptional

Required specifies that this field must be set

const2google.protobuf.Timestampoptional

Const specifies that this field must be exactly the specified value

lt3google.protobuf.Timestampoptional

Lt specifies that this field must be less than the specified value, exclusive

lte4google.protobuf.Timestampoptional

Lte specifies that this field must be less than the specified value, inclusive

gt5google.protobuf.Timestampoptional

Gt specifies that this field must be greater than the specified value, exclusive

gte6google.protobuf.Timestampoptional

Gte specifies that this field must be greater than the specified value, inclusive

lt_now7booloptional

LtNow specifies that this must be less than the current time. LtNow can only be used with the Within rule.

gt_now8booloptional

GtNow specifies that this must be greater than the current time. GtNow can only be used with the Within rule.

within9google.protobuf.Durationoptional

Within specifies that this field must be within this duration of the current time. This constraint can be used alone or with the LtNow and GtNow rules.

Enums

WellKnownRegex contain some well-known patterns.

NameValueDescription
UNKNOWN0
HTTP_HEADER_NAME1

HTTP header name as defined by RFC 7230.

HTTP_HEADER_VALUE2

HTTP header value as defined by RFC 7230.

Extensions

Disabled nullifies any validation rules for this message, including any message fields associated with it that do support validation.

Extends google.protobuf.MessageOptions

optional bool disabled = 1071;

Ignore skips generation of validation methods for this message.

Extends google.protobuf.MessageOptions

optional bool ignored = 1072;

Required ensures that exactly one the field options in a oneof is set; validation fails if no fields in the oneof are set.

Extends google.protobuf.OneofOptions

optional bool required = 1071;

Rules specify the validations to be performed on this field. By default, no validation is performed against a field.

Extends google.protobuf.FieldOptions

optional FieldRules rules = 1071;