linka-cloud
prost-validate
Rust

Prost support for protoc-gen-validate annotations

Last updated May 25, 2026
37
Stars
9
Forks
10
Issues
0
Stars/day
Attention Score
24
Language breakdown
Rust 99.9%
Shell 0.1%
โ–ธ Files click to expand
README

Continuous integration Apache 2.0

Prost Validate

This is a Rust implementation of protoc-gen-validate.

It must be used with prost generated code.

All validation rules are documented in the proto file or in the protoc-gen-validate documentation.

It provides two implementations:

The test suite adapted from the protoc-gen-validate harness tests is shared between the two implementations.

Here are the benchmarks for the tests suite of the two implementations:

prost-reflect-validate:

harness reflect         time:   [14.849 ms 15.128 ms 15.459 ms]

prost-validate:

harness derive          time:   [2.5635 ms 2.5780 ms 2.5967 ms]

Constraint Rule Comparison

Global

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | disabled | โœ… | โœ… |

Numerics

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | const | โœ… | โœ… | | lt/lte/gt/gte | โœ… | โœ… | | in/not_in | โœ… | โœ… |

Bools

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | const | โœ… | โœ… |

Strings

| Constraint Rule | Derive | Reflect | |------------------------|:------:|:-------:| | const | โœ… | โœ… | | len/min\len/maxlen | โœ… | โœ… | | min\bytes/max\bytes | โœ… | โœ… | | pattern | โœ… | โœ… | | prefix/suffix/contains | โœ… | โœ… | | contains/not_contains | โœ… | โœ… | | in/not_in | โœ… | โœ… | | email | โœ… | โœ… | | hostname | โœ… | โœ… | | address | โœ… | โœ… | | ip | โœ… | โœ… | | ipv4 | โœ… | โœ… | | ipv6 | โœ… | โœ… | | uri | โœ… | โœ… | | uri_ref | โœ… | โœ… | | uuid | โœ… | โœ… | | wellknownregex | โœ… | โœ… |

Bytes

| Constraint Rule | Derive | Reflect | |------------------------|:------:|:-------:| | const | โœ… | โœ… | | len/min\len/maxlen | โœ… | โœ… | | pattern | โœ… | โœ… | | prefix/suffix/contains | โœ… | โœ… | | in/not_in | โœ… | โœ… | | ip | โœ… | โœ… | | ipv4 | โœ… | โœ… | | ipv6 | โœ… | โœ… |

Enums

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | const | โœ… | โœ… | | defined_only | โœ… | โœ… | | in/not_in | โœ… | โœ… |

Messages

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | skip | โœ… | โœ… | | required | โœ… | โœ… |

Repeated

| Constraint Rule | Derive | Reflect | |----------------------|:------:|:-------:| | min\items/maxitems | โœ… | โœ… | | unique | โœ… | โœ… | | items | โœ… | โœ… |

Maps

| Constraint Rule | Derive | Reflect | |----------------------|:------:|:-------:| | min\pairs/maxpairs | โœ… | โœ… | | no_sparse | โ“ | โ“ | | keys | โœ… | โœ… | | values | โœ… | โœ… |

OneOf

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | required | โœ… | โœ… |

WKT Scalar Value Wrappers

| Constraint Rule | Derive | Reflect | |--------------------|:------:|:-------:| | wrapper validation | โœ… | โœ… |

WKT Any

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | required | โœ… | โœ… | | in/not_in | โœ… | โœ… |

WKT Duration

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | required | โœ… | โœ… | | const | โœ… | โœ… | | lt/lte/gt/gte | โœ… | โœ… | | in/not_in | โœ… | โœ… |

WKT Timestamp

| Constraint Rule | Derive | Reflect | |-----------------|:------:|:-------:| | required | โœ… | โœ… | | const | โœ… | โœ… | | lt/lte/gt/gte | โœ… | โœ… | | ltnow/gtnow | โœ… | โœ… | | within | โœ… | โœ… |

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท linka-cloud/prost-validate ยท Updated daily from GitHub