Protovalidate provides standard annotations to validate common rules on messages and fields, as well as the ability to use CEL to write custom rules. It's the next generation of protoc-gen-validate, the only widely used validation library for Protobuf.
Supplementing its documentation, this repository provides quickstart code exercises and reference examples for its use.
Quickstart code for Protovalidate's Quickstart is available in the following languages. Each contains a start directory with a starting state and finish with a working solution.
Example code for Adding Protovalidate to Protobuf projects is available for the following build tools:
Example code for Using Protovalidate standard rules provides a library of Protobuf files demonstrating Protovalidate's built-in standard rules.
Example code for Custom CEL rules provides a library of Protobuf files demonstrating Common Expression Language (CEL)-based custom rules.
Quickstart code for Predefined rules shows how to create your own reusable rules. The only code changed during the tutorial is in Protobuf files, so no additional language examples are necessary. It contains a start directory with a starting state and finish with a working solution.
Quickstart code showing how to use Protovalidate in unary RPCs is available in the following languages. Each contains a start directory with a starting state and finish with a working solution.
- Quickstart code for Protovalidate in Connect and Go
- Quickstart code for Protovalidate in gRPC and Go
- Quickstart code for Protovalidate in gRPC and Java
- Quickstart code for Protovalidate in gRPC and Python
Quickstart code for Using Protovalidate in Kafka with Bufstream shows how to enforce schemas within the Bufstream Kafka broker. The only code changed during the tutorial is in Protobuf and YAML files, so only a Go example is provided. It contains a start directory with a starting state and finish with a working solution.