Expand description
Runtime companion for protoc-gen-protovalidate-buffa.
Provides the Validate trait, the ValidationError /
Violation / FieldPath types returned from generated
validate() methods, the cel module of thin helpers that
compile-time-expanded CEL rules call into (scalar widening,
Duration/Timestamp converters, now), and the rules module
of pure-Rust helpers used by generated code (UUID / ULID / IP /
URI / hostname checks and friends, mostly thin wrappers over
uuid, ulid, ipnet, and fluent-uri).
There is no CEL interpreter at runtime: the paired
protoc-gen-protovalidate-buffa plugin transpiles every CEL rule
to native Rust at codegen time. Generated validate() methods are
direct field-access checks without per-call dynamic CEL Value
materialization. Rules that need scratch state, such as repeated-value
uniqueness, allocate it directly.
ValidationError carries three orthogonal signals:
violations: list of per-field rule failures (the common case).compile_error: non-empty when the codegen plugin detected a schema-level mismatch (rule type / field type, duplicate / unknown fields inmessage.oneof, CEL referencing a non-existent field).runtime_error: non-empty when a rule’s precondition could not be evaluated (e.g.bytes.patternon non-UTF-8 input, or a CEL rule that compiled-time analysis flagged as always-runtime-error such asdyn(this).<unknown_field>).
The full upstream protovalidate-conformance suite (2872 cases,
covering proto2, proto3, and editions 2023) passes against code
emitted by the paired plugin.
Re-exports§
pub use protovalidate_buffa_protos::buf::validate as proto;pub use buffa;pub use chrono;pub use regex;
Modules§
Macros§
Structs§
- Decode
Violations Error - A matching validation detail could not be decoded within receiver limits.
- Field
Path - Field
Path Element - Validation
Error - Violation
Enums§
Traits§
Functions§
- decode_
violations - Decodes a canonical validation detail from a Connect or gRPC error.
Attribute Macros§
- connect_
impl #[connect_impl]— attribute macro applied to a Connect serviceimplblock that validates the borrowed request view at the top of every handler method, without converting it to an owned message. RequiresValidateon the generated view type. Guarantees protovalidate runs for every RPC without relying on per-handler discipline.