DurationRules describe the rules applied exclusively to the google.protobuf.Duration well-known type.
DurationRules describe the rules applied exclusively to the google.protobuf.Duration well-known type.
Optional[customReturns a safe value for JSON logs.
Returns a safe value for JSON logs.
Optional[unknownPreserves protobuf fields that this SDK version does not recognize.
Contains the fully qualified protobuf type name.
Optionalconstconst dictates that the field must match the specified value of the google.protobuf.Duration type exactly.
If the field's value deviates from the specified value, an error message
will be generated.
message MyDuration {
// value must equal 5s
google.protobuf.Duration value = 1 [(buf.validate.field).duration.const = "5s"];
}
example specifies values that the field may have. These values SHOULD
conform to other rules. example values will not impact validation
but may be used as helpful guidance on how to populate the given field.
message MyDuration {
google.protobuf.Duration value = 1 [
(buf.validate.field).duration.example = { seconds: 1 },
(buf.validate.field).duration.example = { seconds: 2 },
];
}
OptionalgreaterContains the selected value for the greater_than protobuf oneof.
Contains the case.
Contains the gt.
Contains the case.
Contains the gte.
in asserts that the field must be equal to one of the specified values of the google.protobuf.Duration type.
If the field's value doesn't correspond to any of the specified values,
an error message will be generated.
message MyDuration {
// value must be in list [1s, 2s, 3s]
google.protobuf.Duration value = 1 [(buf.validate.field).duration.in = ["1s", "2s", "3s"]];
}
OptionallessContains the selected value for the less_than protobuf oneof.
Contains the case.
Contains the lt.
Contains the case.
Contains the lte.
not_in denotes that the field must not be equal to
any of the specified values of the google.protobuf.Duration type.
If the field's value matches any of these values, an error message will be
generated.
message MyDuration {
// value must not be in list [1s, 2s, 3s]
google.protobuf.Duration value = 1 [(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]];
}
DurationRules describe the rules applied exclusively to the
google.protobuf.Durationwell-known type.