forked from bufbuild/protoc-gen-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wkt_duration.proto
33 lines (26 loc) · 2.01 KB
/
wkt_duration.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
syntax = "proto3";
package tests.harness.cases;
option go_package = "github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go;cases";
import "validate/validate.proto";
import "google/protobuf/duration.proto";
message DurationNone { google.protobuf.Duration val = 1; }
message DurationRequired { google.protobuf.Duration val = 1 [(validate.rules).duration.required = true]; }
// TODO(htuch): Add a very large duration, e.g. {seconds: 315576000000}, once
// #34 is resolved.
message DurationConst { google.protobuf.Duration val = 1 [(validate.rules).duration.const = {seconds: 3}]; }
message DurationIn { google.protobuf.Duration val = 1 [(validate.rules).duration = {in: [{seconds:1}, {nanos:1000}]}]; }
message DurationNotIn { google.protobuf.Duration val = 1 [(validate.rules).duration = {not_in: [{}]}]; }
message DurationLT { google.protobuf.Duration val = 1 [(validate.rules).duration.lt = {}]; }
message DurationLTE { google.protobuf.Duration val = 1 [(validate.rules).duration.lte = {seconds: 1}]; }
message DurationGT { google.protobuf.Duration val = 1 [(validate.rules).duration.gt = {nanos: 1000}]; }
message DurationGTE { google.protobuf.Duration val = 1 [(validate.rules).duration.gte = {nanos: 1000000}]; }
message DurationGTLT { google.protobuf.Duration val = 1 [(validate.rules).duration = {gt: {}, lt: {seconds: 1}}]; }
message DurationExLTGT { google.protobuf.Duration val = 1 [(validate.rules).duration = {lt: {}, gt: {seconds: 1}}]; }
message DurationGTELTE { google.protobuf.Duration val = 1 [(validate.rules).duration = {gte: {seconds: 60}, lte: {seconds: 3600}}]; }
message DurationExGTELTE { google.protobuf.Duration val = 1 [(validate.rules).duration = {lte: {seconds: 60}, gte: {seconds: 3600}}]; }
// Regression for earlier bug where missing Duration field would short circuit
// evaluation in C++.
message DurationFieldWithOtherFields {
google.protobuf.Duration duration_val = 1 [(validate.rules).duration.lte = {seconds: 1}];
int32 int_val = 2 [(validate.rules).int32.gt = 16];
}