Skip to main content

Crate protovalidate_buffa

Crate protovalidate_buffa 

Source
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 that backs message-level and field-level CEL rules, 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).

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 in message.oneof, CEL referencing a non-existent field).
  • runtime_error: non-empty when a rule’s precondition could not be evaluated (e.g. bytes.pattern on non-UTF-8 input, CEL type mismatch).

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 ::cel as cel_core;
pub use buffa;
pub use regex;

Modules§

cel
rules

Macros§

field_path

Structs§

FieldPath
FieldPathElement
ValidationError
Violation

Enums§

FieldType
Subscript

Traits§

Validate

Attribute Macros§

connect_impl
#[connect_impl] — attribute macro applied to a Connect service impl block that inserts req.validate()? at the top of every handler method. Guarantees protovalidate runs for every RPC without relying on per-handler discipline.