Expand description
Generated Rust types for the buf.validate
protobuf schema, built with prost and prost-reflect.
This crate provides:
- All message and enum types from
buf/validate/validate.proto(e.g.FieldRules,MessageRules,OneofRules). - A shared
DESCRIPTOR_POOLcontaining the file descriptor set for runtime reflection. - Extension traits for extracting constraint annotations from descriptors:
FieldConstraintsExt—buf.validate.fieldrules on aFieldDescriptor.MessageConstraintsExt—buf.validate.messagerules on aMessageDescriptor.OneofConstraintsExt—buf.validate.oneofrules on aOneofDescriptor.PredefinedConstraintsExt—buf.validate.predefinedrules.FieldConstraintsDynExt/MessageConstraintsDynExt— rawDynamicMessageaccess for the runtime validator.
- Typed helper functions for extension extraction with concrete error types:
field_constraints_typed,message_constraints_typed,oneof_constraints_typed,predefined_constraints_typed.
§Usage
Most users do not need this crate directly — the
prost-protovalidate crate re-exports
everything required for validation via its types module. Use this crate when you only need the
generated types or descriptor pool without the evaluation engine.
Modules§
- bytes_
rules - Nested message and enum types in
BytesRules. - double_
rules - Nested message and enum types in
DoubleRules. - duration_
rules - Nested message and enum types in
DurationRules. - field_
path_ element - Nested message and enum types in
FieldPathElement. - field_
rules - Nested message and enum types in
FieldRules. - fixed32_
rules - Nested message and enum types in
Fixed32Rules. - fixed64_
rules - Nested message and enum types in
Fixed64Rules. - float_
rules - Nested message and enum types in
FloatRules. - int32_
rules - Nested message and enum types in
Int32Rules. - int64_
rules - Nested message and enum types in
Int64Rules. - s_
fixed32_ rules - Nested message and enum types in
SFixed32Rules. - s_
fixed64_ rules - Nested message and enum types in
SFixed64Rules. - s_
int32_ rules - Nested message and enum types in
SInt32Rules. - s_
int64_ rules - Nested message and enum types in
SInt64Rules. - string_
rules - Nested message and enum types in
StringRules. - timestamp_
rules - Nested message and enum types in
TimestampRules. - u_
int32_ rules - Nested message and enum types in
UInt32Rules. - u_
int64_ rules - Nested message and enum types in
UInt64Rules.
Structs§
- AnyRules
- AnyRules describe rules applied exclusively to the
google.protobuf.Anywell-known type. - Bool
Rules - BoolRules describes the rules applied to
boolvalues. These rules may also be applied to thegoogle.protobuf.BoolValueWell-Known-Type. - Bytes
Rules - BytesRules describe the rules applied to
bytesvalues. These rules may also be applied to thegoogle.protobuf.BytesValueWell-Known-Type. - Double
Rules - DoubleRules describes the rules applied to
doublevalues. These rules may also be applied to thegoogle.protobuf.DoubleValueWell-Known-Type. - Duration
Rules - DurationRules describe the rules applied exclusively to the
google.protobuf.Durationwell-known type. - Enum
Rules - EnumRules describe the rules applied to
enumvalues. - Field
Mask Rules - FieldMaskRules describe rules applied exclusively to the
google.protobuf.FieldMaskwell-known type. - Field
Path FieldPathprovides a path to a nested protobuf field.- Field
Path Element FieldPathElementprovides enough information to nest through a single protobuf field.- Field
Rules - FieldRules encapsulates the rules for each type of field. Depending on the field, the correct set should be used to ensure proper validations.
- Fixed32
Rules - Fixed32Rules describes the rules applied to
fixed32values. - Fixed64
Rules - Fixed64Rules describes the rules applied to
fixed64values. - Float
Rules - FloatRules describes the rules applied to
floatvalues. These rules may also be applied to thegoogle.protobuf.FloatValueWell-Known-Type. - Int32
Rules - Int32Rules describes the rules applied to
int32values. These rules may also be applied to thegoogle.protobuf.Int32ValueWell-Known-Type. - Int64
Rules - Int64Rules describes the rules applied to
int64values. These rules may also be applied to thegoogle.protobuf.Int64ValueWell-Known-Type. - MapRules
- MapRules describe the rules applied to
mapvalues. - Message
Oneof Rule - Message
Rules - 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.
- Oneof
Rules - The
OneofRulesmessage type enables you to manage rules for oneof fields in your protobuf messages. - Predefined
Rules - PredefinedRules are custom rules that can be re-used with multiple fields.
- Repeated
Rules - RepeatedRules describe the rules applied to
repeatedvalues. - Rule
Rulerepresents 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.- SFixed32
Rules - SFixed32Rules describes the rules applied to
fixed32values. - SFixed64
Rules - SFixed64Rules describes the rules applied to
fixed64values. - SInt32
Rules - SInt32Rules describes the rules applied to
sint32values. - SInt64
Rules - SInt64Rules describes the rules applied to
sint64values. - String
Rules - StringRules describes the rules applied to
stringvalues These rules may also be applied to thegoogle.protobuf.StringValueWell-Known-Type. - Timestamp
Rules - TimestampRules describe the rules applied exclusively to the
google.protobuf.Timestampwell-known type. - UInt32
Rules - UInt32Rules describes the rules applied to
uint32values. These rules may also be applied to thegoogle.protobuf.UInt32ValueWell-Known-Type. - UInt64
Rules - UInt64Rules describes the rules applied to
uint64values. These rules may also be applied to thegoogle.protobuf.UInt64ValueWell-Known-Type. - Violation
Violationrepresents a single instance where a validation rule, expressed as aRule, 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.- Violations
Violationsis a collection ofViolationmessages. This message type is returned by Protovalidate when a proto message fails to meet the requirements set by theRulevalidation rules. Each individual violation is represented by aViolationmessage.
Enums§
- Constraint
Decode Error - Error returned while decoding
buf.validatedescriptor extensions. - Ignore
- Specifies how
FieldRules.ignorebehaves, depending on the field’s value, and whether the field tracks presence. - Known
Regex - KnownRegex contains some well-known patterns.
Statics§
Traits§
- Field
Constraints DynExt - Extension trait for extracting the
DynamicMessageform of field constraints. This is useful for the runtime validator which needs to read rule fields dynamically. - Field
Constraints Ext - Extension trait for extracting
buf.validate.fieldrules from a field descriptor. - Message
Constraints DynExt - Extension trait for extracting the
DynamicMessageform of message constraints. - Message
Constraints Ext - Extension trait for extracting
buf.validate.messagerules from a message descriptor. - Oneof
Constraints Ext - Extension trait for extracting
buf.validate.oneofrules from a oneof descriptor. - Predefined
Constraints Ext - Extension trait for extracting
buf.validate.predefinedrules from a field descriptor.
Functions§
- descriptor_
pool_ decode_ error - field_
constraints_ typed - Typed helper for extracting
buf.validate.fieldrules from a field descriptor. - message_
constraints_ typed - Typed helper for extracting
buf.validate.messagerules from a message descriptor. - oneof_
constraints_ typed - Typed helper for extracting
buf.validate.oneofrules from a oneof descriptor. - predefined_
constraints_ typed - Typed helper for extracting
buf.validate.predefinedrules from a field descriptor.
Type Aliases§
- Constraint
Decode Result - Typed decode result for descriptor extension constraints.