go-proto-validators
go-proto-validators copied to clipboard
Allow specifying validators in grpc_api_configuration sidecar file
grpc_api_configuration is a sidecar .yml file allowing for specifying varying API configurations outside of the .proto file. It would be awesome if go-proto-validators could generate validators for a gRPC configuration based on this, so that clients don't have to include go-proto-validators in a non-Go project.
To take the example on the README.
package validator.examples;
import "github.com/mwitkow/go-proto-validators/validator.proto";
message InnerMessage {
// some_integer can only be in range (1, 100).
int32 some_integer = 1 [(validator.field) = {int_gt: 0, int_lt: 100}];
// some_float can only be in range (0;1).
double some_float = 2 [(validator.field) = {float_gte: 0, float_lte: 1}];
}
Could be specified as:
validators:
- selector: validator.examples.InnerMessage
fields:
- selector: some_integer
field:
int_gt: 0
int_lt: 100
- selector: some_float
field:
int_gt: 0
int_lte: 1