fix buf validate, add sample field validation
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
syntax = "proto3";
|
||||
package demo.app.v1alpha1;
|
||||
|
||||
import "buf/validate/validate.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
@ -9,7 +10,7 @@ option go_package = "gitea.libretechconsulting.com/rmcguire/go-server-with-otel/
|
||||
// Options for random fact, in this case
|
||||
// just a language
|
||||
message GetDemoRequest {
|
||||
optional string language = 1;
|
||||
optional string language = 1 [(buf.validate.field).string.min_len = 2];
|
||||
}
|
||||
|
||||
// Returns a randome fact, because this is a demo app
|
||||
@ -18,7 +19,7 @@ message GetDemoResponse {
|
||||
google.protobuf.Timestamp timestamp = 1;
|
||||
string fact = 2;
|
||||
string source = 3;
|
||||
string language = 4;
|
||||
string language = 4 [(buf.validate.field).string.min_len = 2];
|
||||
}
|
||||
|
||||
service DemoAppService {
|
||||
|
Reference in New Issue
Block a user