proto_types/protovalidate/buf.validate.rs
1// This file is @generated by prost-build.
2/// `Rule` represents a validation rule written in the Common Expression
3/// Language (CEL) syntax. Each Rule includes a unique identifier, an
4/// optional error message, and the CEL expression to evaluate. For more
5/// information, [see our documentation](<https://buf.build/docs/protovalidate/schemas/custom-rules/>).
6///
7/// ```proto
8/// message Foo {
9/// option (buf.validate.message).cel = {
10/// id: "foo.bar"
11/// message: "bar must be greater than 0"
12/// expression: "this.bar > 0"
13/// };
14/// int32 bar = 1;
15/// }
16/// ```
17#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
18pub struct Rule {
19 /// `id` is a string that serves as a machine-readable name for this Rule.
20 /// It should be unique within its scope, which could be either a message or a field.
21 #[prost(string, optional, tag = "1")]
22 pub id: ::core::option::Option<::prost::alloc::string::String>,
23 /// `message` is an optional field that provides a human-readable error message
24 /// for this Rule when the CEL expression evaluates to false. If a
25 /// non-empty message is provided, any strings resulting from the CEL
26 /// expression evaluation are ignored.
27 #[prost(string, optional, tag = "2")]
28 pub message: ::core::option::Option<::prost::alloc::string::String>,
29 /// `expression` is the actual CEL expression that will be evaluated for
30 /// validation. This string must resolve to either a boolean or a string
31 /// value. If the expression evaluates to false or a non-empty string, the
32 /// validation is considered failed, and the message is rejected.
33 #[prost(string, optional, tag = "3")]
34 pub expression: ::core::option::Option<::prost::alloc::string::String>,
35}
36/// MessageRules represents validation rules that are applied to the entire message.
37/// It includes disabling options and a list of Rule messages representing Common Expression Language (CEL) validation rules.
38#[derive(Clone, PartialEq, Eq, ::prost::Message)]
39pub struct MessageRules {
40 /// `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation
41 /// rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax.
42 ///
43 /// This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for
44 /// simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will
45 /// be same as the `expression`.
46 ///
47 /// For more information, [see our documentation](<https://buf.build/docs/protovalidate/schemas/custom-rules/>).
48 ///
49 /// ```proto
50 /// message MyMessage {
51 /// // The field `foo` must be greater than 42.
52 /// option (buf.validate.message).cel_expression = "this.foo > 42";
53 /// // The field `foo` must be less than 84.
54 /// option (buf.validate.message).cel_expression = "this.foo < 84";
55 /// optional int32 foo = 1;
56 /// }
57 /// ```
58 #[prost(string, repeated, tag = "5")]
59 pub cel_expression: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
60 /// `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message.
61 /// These rules are written in Common Expression Language (CEL) syntax. For more information,
62 /// [see our documentation](<https://buf.build/docs/protovalidate/schemas/custom-rules/>).
63 ///
64 ///
65 /// ```proto
66 /// message MyMessage {
67 /// // The field `foo` must be greater than 42.
68 /// option (buf.validate.message).cel = {
69 /// id: "my_message.value",
70 /// message: "value must be greater than 42",
71 /// expression: "this.foo > 42",
72 /// };
73 /// optional int32 foo = 1;
74 /// }
75 /// ```
76 #[prost(message, repeated, tag = "3")]
77 pub cel: ::prost::alloc::vec::Vec<Rule>,
78 /// `oneof` is a repeated field of type MessageOneofRule that specifies a list of fields
79 /// of which at most one can be present. If `required` is also specified, then exactly one
80 /// of the specified fields _must_ be present.
81 ///
82 /// This will enforce oneof-like constraints with a few features not provided by
83 /// actual Protobuf oneof declarations:
84 /// 1. Repeated and map fields are allowed in this validation. In a Protobuf oneof,
85 /// only scalar fields are allowed.
86 /// 2. Fields with implicit presence are allowed. In a Protobuf oneof, all member
87 /// fields have explicit presence. This means that, for the purpose of determining
88 /// how many fields are set, explicitly setting such a field to its zero value is
89 /// effectively the same as not setting it at all.
90 /// 3. This will always generate validation errors for a message unmarshalled from
91 /// serialized data that sets more than one field. With a Protobuf oneof, when
92 /// multiple fields are present in the serialized form, earlier values are usually
93 /// silently ignored when unmarshalling, with only the last field being set when
94 /// unmarshalling completes.
95 ///
96 /// Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means
97 /// only the field that is set will be validated and the unset fields are not validated according to the field rules.
98 /// This behavior can be overridden by setting `ignore` against a field.
99 ///
100 /// ```proto
101 /// message MyMessage {
102 /// // Only one of `field1` or `field2` _can_ be present in this message.
103 /// option (buf.validate.message).oneof = { fields: \["field1", "field2"\] };
104 /// // Exactly one of `field3` or `field4` _must_ be present in this message.
105 /// option (buf.validate.message).oneof = { fields: \["field3", "field4"\], required: true };
106 /// string field1 = 1;
107 /// bytes field2 = 2;
108 /// bool field3 = 3;
109 /// int32 field4 = 4;
110 /// }
111 /// ```
112 #[prost(message, repeated, tag = "4")]
113 pub oneof: ::prost::alloc::vec::Vec<MessageOneofRule>,
114}
115#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
116pub struct MessageOneofRule {
117 /// A list of field names to include in the oneof. All field names must be
118 /// defined in the message. At least one field must be specified, and
119 /// duplicates are not permitted.
120 #[prost(string, repeated, tag = "1")]
121 pub fields: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
122 /// If true, one of the fields specified _must_ be set.
123 #[prost(bool, optional, tag = "2")]
124 pub required: ::core::option::Option<bool>,
125}
126/// The `OneofRules` message type enables you to manage rules for
127/// oneof fields in your protobuf messages.
128#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
129pub struct OneofRules {
130 /// If `required` is true, exactly one field of the oneof must be set. A
131 /// validation error is returned if no fields in the oneof are set. Further rules
132 /// should be placed on the fields themselves to ensure they are valid values,
133 /// such as `min_len` or `gt`.
134 ///
135 /// ```proto
136 /// message MyMessage {
137 /// oneof value {
138 /// // Either `a` or `b` must be set. If `a` is set, it must also be
139 /// // non-empty; whereas if `b` is set, it can still be an empty string.
140 /// option (buf.validate.oneof).required = true;
141 /// string a = 1 \[(buf.validate.field).string.min_len = 1\];
142 /// string b = 2;
143 /// }
144 /// }
145 /// ```
146 #[prost(bool, optional, tag = "1")]
147 pub required: ::core::option::Option<bool>,
148}
149/// FieldRules encapsulates the rules for each type of field. Depending on
150/// the field, the correct set should be used to ensure proper validations.
151#[derive(Clone, PartialEq, ::prost::Message)]
152pub struct FieldRules {
153 /// `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation
154 /// rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax.
155 ///
156 /// This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for
157 /// simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will
158 /// be same as the `expression`.
159 ///
160 /// For more information, [see our documentation](<https://buf.build/docs/protovalidate/schemas/custom-rules/>).
161 ///
162 /// ```proto
163 /// message MyMessage {
164 /// // The field `value` must be greater than 42.
165 /// optional int32 value = 1 \[(buf.validate.field).cel_expression = "this > 42"\];
166 /// }
167 /// ```
168 #[prost(string, repeated, tag = "29")]
169 pub cel_expression: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
170 /// `cel` is a repeated field used to represent a textual expression
171 /// in the Common Expression Language (CEL) syntax. For more information,
172 /// [see our documentation](<https://buf.build/docs/protovalidate/schemas/custom-rules/>).
173 ///
174 /// ```proto
175 /// message MyMessage {
176 /// // The field `value` must be greater than 42.
177 /// optional int32 value = 1 [(buf.validate.field).cel = {
178 /// id: "my_message.value",
179 /// message: "value must be greater than 42",
180 /// expression: "this > 42",
181 /// }];
182 /// }
183 /// ```
184 #[prost(message, repeated, tag = "23")]
185 pub cel: ::prost::alloc::vec::Vec<Rule>,
186 /// If `required` is true, the field must be set. A validation error is returned
187 /// if the field is not set.
188 ///
189 /// ```proto
190 /// syntax="proto3";
191 ///
192 /// message FieldsWithPresence {
193 /// // Requires any string to be set, including the empty string.
194 /// optional string link = 1 [
195 /// (buf.validate.field).required = true
196 /// ];
197 /// // Requires true or false to be set.
198 /// optional bool disabled = 2 [
199 /// (buf.validate.field).required = true
200 /// ];
201 /// // Requires a message to be set, including the empty message.
202 /// SomeMessage msg = 4 [
203 /// (buf.validate.field).required = true
204 /// ];
205 /// }
206 /// ```
207 ///
208 /// All fields in the example above track presence. By default, Protovalidate
209 /// ignores rules on those fields if no value is set. `required` ensures that
210 /// the fields are set and valid.
211 ///
212 /// Fields that don't track presence are always validated by Protovalidate,
213 /// whether they are set or not. It is not necessary to add `required`. It
214 /// can be added to indicate that the field cannot be the zero value.
215 ///
216 /// ```proto
217 /// syntax="proto3";
218 ///
219 /// message FieldsWithoutPresence {
220 /// // `string.email` always applies, even to an empty string.
221 /// string link = 1 [
222 /// (buf.validate.field).string.email = true
223 /// ];
224 /// // `repeated.min_items` always applies, even to an empty list.
225 /// repeated string labels = 2 [
226 /// (buf.validate.field).repeated.min_items = 1
227 /// ];
228 /// // `required`, for fields that don't track presence, indicates
229 /// // the value of the field can't be the zero value.
230 /// int32 zero_value_not_allowed = 3 [
231 /// (buf.validate.field).required = true
232 /// ];
233 /// }
234 /// ```
235 ///
236 /// To learn which fields track presence, see the
237 /// [Field Presence cheat sheet](<https://protobuf.dev/programming-guides/field_presence/#cheat>).
238 ///
239 /// Note: While field rules can be applied to repeated items, map keys, and map
240 /// values, the elements are always considered to be set. Consequently,
241 /// specifying `repeated.items.required` is redundant.
242 #[prost(bool, optional, tag = "25")]
243 pub required: ::core::option::Option<bool>,
244 /// Ignore validation rules on the field if its value matches the specified
245 /// criteria. See the `Ignore` enum for details.
246 ///
247 /// ```proto
248 /// message UpdateRequest {
249 /// // The uri rule only applies if the field is not an empty string.
250 /// string url = 1 [
251 /// (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE,
252 /// (buf.validate.field).string.uri = true
253 /// ];
254 /// }
255 /// ```
256 #[prost(enumeration = "Ignore", optional, tag = "27")]
257 pub ignore: ::core::option::Option<i32>,
258 #[prost(
259 oneof = "field_rules::Type",
260 tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 28, 22"
261 )]
262 pub r#type: ::core::option::Option<field_rules::Type>,
263}
264/// Nested message and enum types in `FieldRules`.
265pub mod field_rules {
266 #[derive(Clone, PartialEq, ::prost::Oneof)]
267 pub enum Type {
268 /// Scalar Field Types
269 #[prost(message, tag = "1")]
270 Float(super::FloatRules),
271 #[prost(message, tag = "2")]
272 Double(super::DoubleRules),
273 #[prost(message, tag = "3")]
274 Int32(super::Int32Rules),
275 #[prost(message, tag = "4")]
276 Int64(super::Int64Rules),
277 #[prost(message, tag = "5")]
278 Uint32(super::UInt32Rules),
279 #[prost(message, tag = "6")]
280 Uint64(super::UInt64Rules),
281 #[prost(message, tag = "7")]
282 Sint32(super::SInt32Rules),
283 #[prost(message, tag = "8")]
284 Sint64(super::SInt64Rules),
285 #[prost(message, tag = "9")]
286 Fixed32(super::Fixed32Rules),
287 #[prost(message, tag = "10")]
288 Fixed64(super::Fixed64Rules),
289 #[prost(message, tag = "11")]
290 Sfixed32(super::SFixed32Rules),
291 #[prost(message, tag = "12")]
292 Sfixed64(super::SFixed64Rules),
293 #[prost(message, tag = "13")]
294 Bool(super::BoolRules),
295 #[prost(message, tag = "14")]
296 String(super::StringRules),
297 #[prost(message, tag = "15")]
298 Bytes(super::BytesRules),
299 /// Complex Field Types
300 #[prost(message, tag = "16")]
301 Enum(super::EnumRules),
302 #[prost(message, tag = "18")]
303 Repeated(::prost::alloc::boxed::Box<super::RepeatedRules>),
304 #[prost(message, tag = "19")]
305 Map(::prost::alloc::boxed::Box<super::MapRules>),
306 /// Well-Known Field Types
307 #[prost(message, tag = "20")]
308 Any(super::AnyRules),
309 #[prost(message, tag = "21")]
310 Duration(super::DurationRules),
311 #[prost(message, tag = "28")]
312 FieldMask(super::FieldMaskRules),
313 #[prost(message, tag = "22")]
314 Timestamp(super::TimestampRules),
315 }
316}
317/// PredefinedRules are custom rules that can be re-used with
318/// multiple fields.
319#[derive(Clone, PartialEq, Eq, ::prost::Message)]
320pub struct PredefinedRules {
321 /// `cel` is a repeated field used to represent a textual expression
322 /// in the Common Expression Language (CEL) syntax. For more information,
323 /// [see our documentation](<https://buf.build/docs/protovalidate/schemas/predefined-rules/>).
324 ///
325 /// ```proto
326 /// message MyMessage {
327 /// // The field `value` must be greater than 42.
328 /// optional int32 value = 1 [(buf.validate.predefined).cel = {
329 /// id: "my_message.value",
330 /// message: "value must be greater than 42",
331 /// expression: "this > 42",
332 /// }];
333 /// }
334 /// ```
335 #[prost(message, repeated, tag = "1")]
336 pub cel: ::prost::alloc::vec::Vec<Rule>,
337}
338/// FloatRules describes the rules applied to `float` values. These
339/// rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type.
340#[derive(Clone, PartialEq, ::prost::Message)]
341pub struct FloatRules {
342 /// `const` requires the field value to exactly match the specified value. If
343 /// the field value doesn't match, an error message is generated.
344 ///
345 /// ```proto
346 /// message MyFloat {
347 /// // value must equal 42.0
348 /// float value = 1 \[(buf.validate.field).float.const = 42.0\];
349 /// }
350 /// ```
351 #[prost(float, optional, tag = "1")]
352 pub r#const: ::core::option::Option<f32>,
353 /// `in` requires the field value to be equal to one of the specified values.
354 /// If the field value isn't one of the specified values, an error message
355 /// is generated.
356 ///
357 /// ```proto
358 /// message MyFloat {
359 /// // value must be in list \[1.0, 2.0, 3.0\]
360 /// float value = 1 \[(buf.validate.field).float = { in: [1.0, 2.0, 3.0\] }];
361 /// }
362 /// ```
363 #[prost(float, repeated, packed = "false", tag = "6")]
364 pub r#in: ::prost::alloc::vec::Vec<f32>,
365 /// `in` requires the field value to not be equal to any of the specified
366 /// values. If the field value is one of the specified values, an error
367 /// message is generated.
368 ///
369 /// ```proto
370 /// message MyFloat {
371 /// // value must not be in list \[1.0, 2.0, 3.0\]
372 /// float value = 1 \[(buf.validate.field).float = { not_in: [1.0, 2.0, 3.0\] }];
373 /// }
374 /// ```
375 #[prost(float, repeated, packed = "false", tag = "7")]
376 pub not_in: ::prost::alloc::vec::Vec<f32>,
377 /// `finite` requires the field value to be finite. If the field value is
378 /// infinite or NaN, an error message is generated.
379 #[prost(bool, optional, tag = "8")]
380 pub finite: ::core::option::Option<bool>,
381 /// `example` specifies values that the field may have. These values SHOULD
382 /// conform to other rules. `example` values will not impact validation
383 /// but may be used as helpful guidance on how to populate the given field.
384 ///
385 /// ```proto
386 /// message MyFloat {
387 /// float value = 1 [
388 /// (buf.validate.field).float.example = 1.0,
389 /// (buf.validate.field).float.example = inf
390 /// ];
391 /// }
392 /// ```
393 #[prost(float, repeated, packed = "false", tag = "9")]
394 pub example: ::prost::alloc::vec::Vec<f32>,
395 #[prost(oneof = "float_rules::LessThan", tags = "2, 3")]
396 pub less_than: ::core::option::Option<float_rules::LessThan>,
397 #[prost(oneof = "float_rules::GreaterThan", tags = "4, 5")]
398 pub greater_than: ::core::option::Option<float_rules::GreaterThan>,
399}
400/// Nested message and enum types in `FloatRules`.
401pub mod float_rules {
402 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
403 pub enum LessThan {
404 /// `lt` requires the field value to be less than the specified value (field <
405 /// value). If the field value is equal to or greater than the specified value,
406 /// an error message is generated.
407 ///
408 /// ```proto
409 /// message MyFloat {
410 /// // value must be less than 10.0
411 /// float value = 1 \[(buf.validate.field).float.lt = 10.0\];
412 /// }
413 /// ```
414 #[prost(float, tag = "2")]
415 Lt(f32),
416 /// `lte` requires the field value to be less than or equal to the specified
417 /// value (field <= value). If the field value is greater than the specified
418 /// value, an error message is generated.
419 ///
420 /// ```proto
421 /// message MyFloat {
422 /// // value must be less than or equal to 10.0
423 /// float value = 1 \[(buf.validate.field).float.lte = 10.0\];
424 /// }
425 /// ```
426 #[prost(float, tag = "3")]
427 Lte(f32),
428 }
429 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
430 pub enum GreaterThan {
431 /// `gt` requires the field value to be greater than the specified value
432 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
433 /// `lte`, the range is reversed, and the field value must be outside the
434 /// specified range. If the field value doesn't meet the required conditions,
435 /// an error message is generated.
436 ///
437 /// ```proto
438 /// message MyFloat {
439 /// // value must be greater than 5.0 \[float.gt\]
440 /// float value = 1 \[(buf.validate.field).float.gt = 5.0\];
441 ///
442 /// // value must be greater than 5 and less than 10.0 \[float.gt_lt\]
443 /// float other_value = 2 \[(buf.validate.field).float = { gt: 5.0, lt: 10.0 }\];
444 ///
445 /// // value must be greater than 10 or less than 5.0 \[float.gt_lt_exclusive\]
446 /// float another_value = 3 \[(buf.validate.field).float = { gt: 10.0, lt: 5.0 }\];
447 /// }
448 /// ```
449 #[prost(float, tag = "4")]
450 Gt(f32),
451 /// `gte` requires the field value to be greater than or equal to the specified
452 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
453 /// or `lte`, the range is reversed, and the field value must be outside the
454 /// specified range. If the field value doesn't meet the required conditions,
455 /// an error message is generated.
456 ///
457 /// ```proto
458 /// message MyFloat {
459 /// // value must be greater than or equal to 5.0 \[float.gte\]
460 /// float value = 1 \[(buf.validate.field).float.gte = 5.0\];
461 ///
462 /// // value must be greater than or equal to 5.0 and less than 10.0 \[float.gte_lt\]
463 /// float other_value = 2 \[(buf.validate.field).float = { gte: 5.0, lt: 10.0 }\];
464 ///
465 /// // value must be greater than or equal to 10.0 or less than 5.0 \[float.gte_lt_exclusive\]
466 /// float another_value = 3 \[(buf.validate.field).float = { gte: 10.0, lt: 5.0 }\];
467 /// }
468 /// ```
469 #[prost(float, tag = "5")]
470 Gte(f32),
471 }
472}
473/// DoubleRules describes the rules applied to `double` values. These
474/// rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type.
475#[derive(Clone, PartialEq, ::prost::Message)]
476pub struct DoubleRules {
477 /// `const` requires the field value to exactly match the specified value. If
478 /// the field value doesn't match, an error message is generated.
479 ///
480 /// ```proto
481 /// message MyDouble {
482 /// // value must equal 42.0
483 /// double value = 1 \[(buf.validate.field).double.const = 42.0\];
484 /// }
485 /// ```
486 #[prost(double, optional, tag = "1")]
487 pub r#const: ::core::option::Option<f64>,
488 /// `in` requires the field value to be equal to one of the specified values.
489 /// If the field value isn't one of the specified values, an error message is
490 /// generated.
491 ///
492 /// ```proto
493 /// message MyDouble {
494 /// // value must be in list \[1.0, 2.0, 3.0\]
495 /// double value = 1 \[(buf.validate.field).double = { in: [1.0, 2.0, 3.0\] }];
496 /// }
497 /// ```
498 #[prost(double, repeated, packed = "false", tag = "6")]
499 pub r#in: ::prost::alloc::vec::Vec<f64>,
500 /// `not_in` requires the field value to not be equal to any of the specified
501 /// values. If the field value is one of the specified values, an error
502 /// message is generated.
503 ///
504 /// ```proto
505 /// message MyDouble {
506 /// // value must not be in list \[1.0, 2.0, 3.0\]
507 /// double value = 1 \[(buf.validate.field).double = { not_in: [1.0, 2.0, 3.0\] }];
508 /// }
509 /// ```
510 #[prost(double, repeated, packed = "false", tag = "7")]
511 pub not_in: ::prost::alloc::vec::Vec<f64>,
512 /// `finite` requires the field value to be finite. If the field value is
513 /// infinite or NaN, an error message is generated.
514 #[prost(bool, optional, tag = "8")]
515 pub finite: ::core::option::Option<bool>,
516 /// `example` specifies values that the field may have. These values SHOULD
517 /// conform to other rules. `example` values will not impact validation
518 /// but may be used as helpful guidance on how to populate the given field.
519 ///
520 /// ```proto
521 /// message MyDouble {
522 /// double value = 1 [
523 /// (buf.validate.field).double.example = 1.0,
524 /// (buf.validate.field).double.example = inf
525 /// ];
526 /// }
527 /// ```
528 #[prost(double, repeated, packed = "false", tag = "9")]
529 pub example: ::prost::alloc::vec::Vec<f64>,
530 #[prost(oneof = "double_rules::LessThan", tags = "2, 3")]
531 pub less_than: ::core::option::Option<double_rules::LessThan>,
532 #[prost(oneof = "double_rules::GreaterThan", tags = "4, 5")]
533 pub greater_than: ::core::option::Option<double_rules::GreaterThan>,
534}
535/// Nested message and enum types in `DoubleRules`.
536pub mod double_rules {
537 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
538 pub enum LessThan {
539 /// `lt` requires the field value to be less than the specified value (field <
540 /// value). If the field value is equal to or greater than the specified
541 /// value, an error message is generated.
542 ///
543 /// ```proto
544 /// message MyDouble {
545 /// // value must be less than 10.0
546 /// double value = 1 \[(buf.validate.field).double.lt = 10.0\];
547 /// }
548 /// ```
549 #[prost(double, tag = "2")]
550 Lt(f64),
551 /// `lte` requires the field value to be less than or equal to the specified value
552 /// (field <= value). If the field value is greater than the specified value,
553 /// an error message is generated.
554 ///
555 /// ```proto
556 /// message MyDouble {
557 /// // value must be less than or equal to 10.0
558 /// double value = 1 \[(buf.validate.field).double.lte = 10.0\];
559 /// }
560 /// ```
561 #[prost(double, tag = "3")]
562 Lte(f64),
563 }
564 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
565 pub enum GreaterThan {
566 /// `gt` requires the field value to be greater than the specified value
567 /// (exclusive). If the value of `gt` is larger than a specified `lt` or `lte`,
568 /// the range is reversed, and the field value must be outside the specified
569 /// range. If the field value doesn't meet the required conditions, an error
570 /// message is generated.
571 ///
572 /// ```proto
573 /// message MyDouble {
574 /// // value must be greater than 5.0 \[double.gt\]
575 /// double value = 1 \[(buf.validate.field).double.gt = 5.0\];
576 ///
577 /// // value must be greater than 5 and less than 10.0 \[double.gt_lt\]
578 /// double other_value = 2 \[(buf.validate.field).double = { gt: 5.0, lt: 10.0 }\];
579 ///
580 /// // value must be greater than 10 or less than 5.0 \[double.gt_lt_exclusive\]
581 /// double another_value = 3 \[(buf.validate.field).double = { gt: 10.0, lt: 5.0 }\];
582 /// }
583 /// ```
584 #[prost(double, tag = "4")]
585 Gt(f64),
586 /// `gte` requires the field value to be greater than or equal to the specified
587 /// value (exclusive). If the value of `gte` is larger than a specified `lt` or
588 /// `lte`, the range is reversed, and the field value must be outside the
589 /// specified range. If the field value doesn't meet the required conditions,
590 /// an error message is generated.
591 ///
592 /// ```proto
593 /// message MyDouble {
594 /// // value must be greater than or equal to 5.0 \[double.gte\]
595 /// double value = 1 \[(buf.validate.field).double.gte = 5.0\];
596 ///
597 /// // value must be greater than or equal to 5.0 and less than 10.0 \[double.gte_lt\]
598 /// double other_value = 2 \[(buf.validate.field).double = { gte: 5.0, lt: 10.0 }\];
599 ///
600 /// // value must be greater than or equal to 10.0 or less than 5.0 \[double.gte_lt_exclusive\]
601 /// double another_value = 3 \[(buf.validate.field).double = { gte: 10.0, lt: 5.0 }\];
602 /// }
603 /// ```
604 #[prost(double, tag = "5")]
605 Gte(f64),
606 }
607}
608/// Int32Rules describes the rules applied to `int32` values. These
609/// rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type.
610#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
611pub struct Int32Rules {
612 /// `const` requires the field value to exactly match the specified value. If
613 /// the field value doesn't match, an error message is generated.
614 ///
615 /// ```proto
616 /// message MyInt32 {
617 /// // value must equal 42
618 /// int32 value = 1 \[(buf.validate.field).int32.const = 42\];
619 /// }
620 /// ```
621 #[prost(int32, optional, tag = "1")]
622 pub r#const: ::core::option::Option<i32>,
623 /// `in` requires the field value to be equal to one of the specified values.
624 /// If the field value isn't one of the specified values, an error message is
625 /// generated.
626 ///
627 /// ```proto
628 /// message MyInt32 {
629 /// // value must be in list \[1, 2, 3\]
630 /// int32 value = 1 \[(buf.validate.field).int32 = { in: [1, 2, 3\] }];
631 /// }
632 /// ```
633 #[prost(int32, repeated, packed = "false", tag = "6")]
634 pub r#in: ::prost::alloc::vec::Vec<i32>,
635 /// `not_in` requires the field value to not be equal to any of the specified
636 /// values. If the field value is one of the specified values, an error message
637 /// is generated.
638 ///
639 /// ```proto
640 /// message MyInt32 {
641 /// // value must not be in list \[1, 2, 3\]
642 /// int32 value = 1 \[(buf.validate.field).int32 = { not_in: [1, 2, 3\] }];
643 /// }
644 /// ```
645 #[prost(int32, repeated, packed = "false", tag = "7")]
646 pub not_in: ::prost::alloc::vec::Vec<i32>,
647 /// `example` specifies values that the field may have. These values SHOULD
648 /// conform to other rules. `example` values will not impact validation
649 /// but may be used as helpful guidance on how to populate the given field.
650 ///
651 /// ```proto
652 /// message MyInt32 {
653 /// int32 value = 1 [
654 /// (buf.validate.field).int32.example = 1,
655 /// (buf.validate.field).int32.example = -10
656 /// ];
657 /// }
658 /// ```
659 #[prost(int32, repeated, packed = "false", tag = "8")]
660 pub example: ::prost::alloc::vec::Vec<i32>,
661 #[prost(oneof = "int32_rules::LessThan", tags = "2, 3")]
662 pub less_than: ::core::option::Option<int32_rules::LessThan>,
663 #[prost(oneof = "int32_rules::GreaterThan", tags = "4, 5")]
664 pub greater_than: ::core::option::Option<int32_rules::GreaterThan>,
665}
666/// Nested message and enum types in `Int32Rules`.
667pub mod int32_rules {
668 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
669 pub enum LessThan {
670 /// `lt` requires the field value to be less than the specified value (field
671 /// < value). If the field value is equal to or greater than the specified
672 /// value, an error message is generated.
673 ///
674 /// ```proto
675 /// message MyInt32 {
676 /// // value must be less than 10
677 /// int32 value = 1 \[(buf.validate.field).int32.lt = 10\];
678 /// }
679 /// ```
680 #[prost(int32, tag = "2")]
681 Lt(i32),
682 /// `lte` requires the field value to be less than or equal to the specified
683 /// value (field <= value). If the field value is greater than the specified
684 /// value, an error message is generated.
685 ///
686 /// ```proto
687 /// message MyInt32 {
688 /// // value must be less than or equal to 10
689 /// int32 value = 1 \[(buf.validate.field).int32.lte = 10\];
690 /// }
691 /// ```
692 #[prost(int32, tag = "3")]
693 Lte(i32),
694 }
695 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
696 pub enum GreaterThan {
697 /// `gt` requires the field value to be greater than the specified value
698 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
699 /// `lte`, the range is reversed, and the field value must be outside the
700 /// specified range. If the field value doesn't meet the required conditions,
701 /// an error message is generated.
702 ///
703 /// ```proto
704 /// message MyInt32 {
705 /// // value must be greater than 5 \[int32.gt\]
706 /// int32 value = 1 \[(buf.validate.field).int32.gt = 5\];
707 ///
708 /// // value must be greater than 5 and less than 10 \[int32.gt_lt\]
709 /// int32 other_value = 2 \[(buf.validate.field).int32 = { gt: 5, lt: 10 }\];
710 ///
711 /// // value must be greater than 10 or less than 5 \[int32.gt_lt_exclusive\]
712 /// int32 another_value = 3 \[(buf.validate.field).int32 = { gt: 10, lt: 5 }\];
713 /// }
714 /// ```
715 #[prost(int32, tag = "4")]
716 Gt(i32),
717 /// `gte` requires the field value to be greater than or equal to the specified value
718 /// (exclusive). If the value of `gte` is larger than a specified `lt` or
719 /// `lte`, the range is reversed, and the field value must be outside the
720 /// specified range. If the field value doesn't meet the required conditions,
721 /// an error message is generated.
722 ///
723 /// ```proto
724 /// message MyInt32 {
725 /// // value must be greater than or equal to 5 \[int32.gte\]
726 /// int32 value = 1 \[(buf.validate.field).int32.gte = 5\];
727 ///
728 /// // value must be greater than or equal to 5 and less than 10 \[int32.gte_lt\]
729 /// int32 other_value = 2 \[(buf.validate.field).int32 = { gte: 5, lt: 10 }\];
730 ///
731 /// // value must be greater than or equal to 10 or less than 5 \[int32.gte_lt_exclusive\]
732 /// int32 another_value = 3 \[(buf.validate.field).int32 = { gte: 10, lt: 5 }\];
733 /// }
734 /// ```
735 #[prost(int32, tag = "5")]
736 Gte(i32),
737 }
738}
739/// Int64Rules describes the rules applied to `int64` values. These
740/// rules may also be applied to the `google.protobuf.Int64Value` Well-Known-Type.
741#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
742pub struct Int64Rules {
743 /// `const` requires the field value to exactly match the specified value. If
744 /// the field value doesn't match, an error message is generated.
745 ///
746 /// ```proto
747 /// message MyInt64 {
748 /// // value must equal 42
749 /// int64 value = 1 \[(buf.validate.field).int64.const = 42\];
750 /// }
751 /// ```
752 #[prost(int64, optional, tag = "1")]
753 pub r#const: ::core::option::Option<i64>,
754 /// `in` requires the field value to be equal to one of the specified values.
755 /// If the field value isn't one of the specified values, an error message is
756 /// generated.
757 ///
758 /// ```proto
759 /// message MyInt64 {
760 /// // value must be in list \[1, 2, 3\]
761 /// int64 value = 1 \[(buf.validate.field).int64 = { in: [1, 2, 3\] }];
762 /// }
763 /// ```
764 #[prost(int64, repeated, packed = "false", tag = "6")]
765 pub r#in: ::prost::alloc::vec::Vec<i64>,
766 /// `not_in` requires the field value to not be equal to any of the specified
767 /// values. If the field value is one of the specified values, an error
768 /// message is generated.
769 ///
770 /// ```proto
771 /// message MyInt64 {
772 /// // value must not be in list \[1, 2, 3\]
773 /// int64 value = 1 \[(buf.validate.field).int64 = { not_in: [1, 2, 3\] }];
774 /// }
775 /// ```
776 #[prost(int64, repeated, packed = "false", tag = "7")]
777 pub not_in: ::prost::alloc::vec::Vec<i64>,
778 /// `example` specifies values that the field may have. These values SHOULD
779 /// conform to other rules. `example` values will not impact validation
780 /// but may be used as helpful guidance on how to populate the given field.
781 ///
782 /// ```proto
783 /// message MyInt64 {
784 /// int64 value = 1 [
785 /// (buf.validate.field).int64.example = 1,
786 /// (buf.validate.field).int64.example = -10
787 /// ];
788 /// }
789 /// ```
790 #[prost(int64, repeated, packed = "false", tag = "9")]
791 pub example: ::prost::alloc::vec::Vec<i64>,
792 #[prost(oneof = "int64_rules::LessThan", tags = "2, 3")]
793 pub less_than: ::core::option::Option<int64_rules::LessThan>,
794 #[prost(oneof = "int64_rules::GreaterThan", tags = "4, 5")]
795 pub greater_than: ::core::option::Option<int64_rules::GreaterThan>,
796}
797/// Nested message and enum types in `Int64Rules`.
798pub mod int64_rules {
799 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
800 pub enum LessThan {
801 /// `lt` requires the field value to be less than the specified value (field <
802 /// value). If the field value is equal to or greater than the specified value,
803 /// an error message is generated.
804 ///
805 /// ```proto
806 /// message MyInt64 {
807 /// // value must be less than 10
808 /// int64 value = 1 \[(buf.validate.field).int64.lt = 10\];
809 /// }
810 /// ```
811 #[prost(int64, tag = "2")]
812 Lt(i64),
813 /// `lte` requires the field value to be less than or equal to the specified
814 /// value (field <= value). If the field value is greater than the specified
815 /// value, an error message is generated.
816 ///
817 /// ```proto
818 /// message MyInt64 {
819 /// // value must be less than or equal to 10
820 /// int64 value = 1 \[(buf.validate.field).int64.lte = 10\];
821 /// }
822 /// ```
823 #[prost(int64, tag = "3")]
824 Lte(i64),
825 }
826 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
827 pub enum GreaterThan {
828 /// `gt` requires the field value to be greater than the specified value
829 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
830 /// `lte`, the range is reversed, and the field value must be outside the
831 /// specified range. If the field value doesn't meet the required conditions,
832 /// an error message is generated.
833 ///
834 /// ```proto
835 /// message MyInt64 {
836 /// // value must be greater than 5 \[int64.gt\]
837 /// int64 value = 1 \[(buf.validate.field).int64.gt = 5\];
838 ///
839 /// // value must be greater than 5 and less than 10 \[int64.gt_lt\]
840 /// int64 other_value = 2 \[(buf.validate.field).int64 = { gt: 5, lt: 10 }\];
841 ///
842 /// // value must be greater than 10 or less than 5 \[int64.gt_lt_exclusive\]
843 /// int64 another_value = 3 \[(buf.validate.field).int64 = { gt: 10, lt: 5 }\];
844 /// }
845 /// ```
846 #[prost(int64, tag = "4")]
847 Gt(i64),
848 /// `gte` requires the field value to be greater than or equal to the specified
849 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
850 /// or `lte`, the range is reversed, and the field value must be outside the
851 /// specified range. If the field value doesn't meet the required conditions,
852 /// an error message is generated.
853 ///
854 /// ```proto
855 /// message MyInt64 {
856 /// // value must be greater than or equal to 5 \[int64.gte\]
857 /// int64 value = 1 \[(buf.validate.field).int64.gte = 5\];
858 ///
859 /// // value must be greater than or equal to 5 and less than 10 \[int64.gte_lt\]
860 /// int64 other_value = 2 \[(buf.validate.field).int64 = { gte: 5, lt: 10 }\];
861 ///
862 /// // value must be greater than or equal to 10 or less than 5 \[int64.gte_lt_exclusive\]
863 /// int64 another_value = 3 \[(buf.validate.field).int64 = { gte: 10, lt: 5 }\];
864 /// }
865 /// ```
866 #[prost(int64, tag = "5")]
867 Gte(i64),
868 }
869}
870/// UInt32Rules describes the rules applied to `uint32` values. These
871/// rules may also be applied to the `google.protobuf.UInt32Value` Well-Known-Type.
872#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
873pub struct UInt32Rules {
874 /// `const` requires the field value to exactly match the specified value. If
875 /// the field value doesn't match, an error message is generated.
876 ///
877 /// ```proto
878 /// message MyUInt32 {
879 /// // value must equal 42
880 /// uint32 value = 1 \[(buf.validate.field).uint32.const = 42\];
881 /// }
882 /// ```
883 #[prost(uint32, optional, tag = "1")]
884 pub r#const: ::core::option::Option<u32>,
885 /// `in` requires the field value to be equal to one of the specified values.
886 /// If the field value isn't one of the specified values, an error message is
887 /// generated.
888 ///
889 /// ```proto
890 /// message MyUInt32 {
891 /// // value must be in list \[1, 2, 3\]
892 /// uint32 value = 1 \[(buf.validate.field).uint32 = { in: [1, 2, 3\] }];
893 /// }
894 /// ```
895 #[prost(uint32, repeated, packed = "false", tag = "6")]
896 pub r#in: ::prost::alloc::vec::Vec<u32>,
897 /// `not_in` requires the field value to not be equal to any of the specified
898 /// values. If the field value is one of the specified values, an error
899 /// message is generated.
900 ///
901 /// ```proto
902 /// message MyUInt32 {
903 /// // value must not be in list \[1, 2, 3\]
904 /// uint32 value = 1 \[(buf.validate.field).uint32 = { not_in: [1, 2, 3\] }];
905 /// }
906 /// ```
907 #[prost(uint32, repeated, packed = "false", tag = "7")]
908 pub not_in: ::prost::alloc::vec::Vec<u32>,
909 /// `example` specifies values that the field may have. These values SHOULD
910 /// conform to other rules. `example` values will not impact validation
911 /// but may be used as helpful guidance on how to populate the given field.
912 ///
913 /// ```proto
914 /// message MyUInt32 {
915 /// uint32 value = 1 [
916 /// (buf.validate.field).uint32.example = 1,
917 /// (buf.validate.field).uint32.example = 10
918 /// ];
919 /// }
920 /// ```
921 #[prost(uint32, repeated, packed = "false", tag = "8")]
922 pub example: ::prost::alloc::vec::Vec<u32>,
923 #[prost(oneof = "u_int32_rules::LessThan", tags = "2, 3")]
924 pub less_than: ::core::option::Option<u_int32_rules::LessThan>,
925 #[prost(oneof = "u_int32_rules::GreaterThan", tags = "4, 5")]
926 pub greater_than: ::core::option::Option<u_int32_rules::GreaterThan>,
927}
928/// Nested message and enum types in `UInt32Rules`.
929pub mod u_int32_rules {
930 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
931 pub enum LessThan {
932 /// `lt` requires the field value to be less than the specified value (field <
933 /// value). If the field value is equal to or greater than the specified value,
934 /// an error message is generated.
935 ///
936 /// ```proto
937 /// message MyUInt32 {
938 /// // value must be less than 10
939 /// uint32 value = 1 \[(buf.validate.field).uint32.lt = 10\];
940 /// }
941 /// ```
942 #[prost(uint32, tag = "2")]
943 Lt(u32),
944 /// `lte` requires the field value to be less than or equal to the specified
945 /// value (field <= value). If the field value is greater than the specified
946 /// value, an error message is generated.
947 ///
948 /// ```proto
949 /// message MyUInt32 {
950 /// // value must be less than or equal to 10
951 /// uint32 value = 1 \[(buf.validate.field).uint32.lte = 10\];
952 /// }
953 /// ```
954 #[prost(uint32, tag = "3")]
955 Lte(u32),
956 }
957 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
958 pub enum GreaterThan {
959 /// `gt` requires the field value to be greater than the specified value
960 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
961 /// `lte`, the range is reversed, and the field value must be outside the
962 /// specified range. If the field value doesn't meet the required conditions,
963 /// an error message is generated.
964 ///
965 /// ```proto
966 /// message MyUInt32 {
967 /// // value must be greater than 5 \[uint32.gt\]
968 /// uint32 value = 1 \[(buf.validate.field).uint32.gt = 5\];
969 ///
970 /// // value must be greater than 5 and less than 10 \[uint32.gt_lt\]
971 /// uint32 other_value = 2 \[(buf.validate.field).uint32 = { gt: 5, lt: 10 }\];
972 ///
973 /// // value must be greater than 10 or less than 5 \[uint32.gt_lt_exclusive\]
974 /// uint32 another_value = 3 \[(buf.validate.field).uint32 = { gt: 10, lt: 5 }\];
975 /// }
976 /// ```
977 #[prost(uint32, tag = "4")]
978 Gt(u32),
979 /// `gte` requires the field value to be greater than or equal to the specified
980 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
981 /// or `lte`, the range is reversed, and the field value must be outside the
982 /// specified range. If the field value doesn't meet the required conditions,
983 /// an error message is generated.
984 ///
985 /// ```proto
986 /// message MyUInt32 {
987 /// // value must be greater than or equal to 5 \[uint32.gte\]
988 /// uint32 value = 1 \[(buf.validate.field).uint32.gte = 5\];
989 ///
990 /// // value must be greater than or equal to 5 and less than 10 \[uint32.gte_lt\]
991 /// uint32 other_value = 2 \[(buf.validate.field).uint32 = { gte: 5, lt: 10 }\];
992 ///
993 /// // value must be greater than or equal to 10 or less than 5 \[uint32.gte_lt_exclusive\]
994 /// uint32 another_value = 3 \[(buf.validate.field).uint32 = { gte: 10, lt: 5 }\];
995 /// }
996 /// ```
997 #[prost(uint32, tag = "5")]
998 Gte(u32),
999 }
1000}
1001/// UInt64Rules describes the rules applied to `uint64` values. These
1002/// rules may also be applied to the `google.protobuf.UInt64Value` Well-Known-Type.
1003#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1004pub struct UInt64Rules {
1005 /// `const` requires the field value to exactly match the specified value. If
1006 /// the field value doesn't match, an error message is generated.
1007 ///
1008 /// ```proto
1009 /// message MyUInt64 {
1010 /// // value must equal 42
1011 /// uint64 value = 1 \[(buf.validate.field).uint64.const = 42\];
1012 /// }
1013 /// ```
1014 #[prost(uint64, optional, tag = "1")]
1015 pub r#const: ::core::option::Option<u64>,
1016 /// `in` requires the field value to be equal to one of the specified values.
1017 /// If the field value isn't one of the specified values, an error message is
1018 /// generated.
1019 ///
1020 /// ```proto
1021 /// message MyUInt64 {
1022 /// // value must be in list \[1, 2, 3\]
1023 /// uint64 value = 1 \[(buf.validate.field).uint64 = { in: [1, 2, 3\] }];
1024 /// }
1025 /// ```
1026 #[prost(uint64, repeated, packed = "false", tag = "6")]
1027 pub r#in: ::prost::alloc::vec::Vec<u64>,
1028 /// `not_in` requires the field value to not be equal to any of the specified
1029 /// values. If the field value is one of the specified values, an error
1030 /// message is generated.
1031 ///
1032 /// ```proto
1033 /// message MyUInt64 {
1034 /// // value must not be in list \[1, 2, 3\]
1035 /// uint64 value = 1 \[(buf.validate.field).uint64 = { not_in: [1, 2, 3\] }];
1036 /// }
1037 /// ```
1038 #[prost(uint64, repeated, packed = "false", tag = "7")]
1039 pub not_in: ::prost::alloc::vec::Vec<u64>,
1040 /// `example` specifies values that the field may have. These values SHOULD
1041 /// conform to other rules. `example` values will not impact validation
1042 /// but may be used as helpful guidance on how to populate the given field.
1043 ///
1044 /// ```proto
1045 /// message MyUInt64 {
1046 /// uint64 value = 1 [
1047 /// (buf.validate.field).uint64.example = 1,
1048 /// (buf.validate.field).uint64.example = -10
1049 /// ];
1050 /// }
1051 /// ```
1052 #[prost(uint64, repeated, packed = "false", tag = "8")]
1053 pub example: ::prost::alloc::vec::Vec<u64>,
1054 #[prost(oneof = "u_int64_rules::LessThan", tags = "2, 3")]
1055 pub less_than: ::core::option::Option<u_int64_rules::LessThan>,
1056 #[prost(oneof = "u_int64_rules::GreaterThan", tags = "4, 5")]
1057 pub greater_than: ::core::option::Option<u_int64_rules::GreaterThan>,
1058}
1059/// Nested message and enum types in `UInt64Rules`.
1060pub mod u_int64_rules {
1061 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1062 pub enum LessThan {
1063 /// `lt` requires the field value to be less than the specified value (field <
1064 /// value). If the field value is equal to or greater than the specified value,
1065 /// an error message is generated.
1066 ///
1067 /// ```proto
1068 /// message MyUInt64 {
1069 /// // value must be less than 10
1070 /// uint64 value = 1 \[(buf.validate.field).uint64.lt = 10\];
1071 /// }
1072 /// ```
1073 #[prost(uint64, tag = "2")]
1074 Lt(u64),
1075 /// `lte` requires the field value to be less than or equal to the specified
1076 /// value (field <= value). If the field value is greater than the specified
1077 /// value, an error message is generated.
1078 ///
1079 /// ```proto
1080 /// message MyUInt64 {
1081 /// // value must be less than or equal to 10
1082 /// uint64 value = 1 \[(buf.validate.field).uint64.lte = 10\];
1083 /// }
1084 /// ```
1085 #[prost(uint64, tag = "3")]
1086 Lte(u64),
1087 }
1088 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1089 pub enum GreaterThan {
1090 /// `gt` requires the field value to be greater than the specified value
1091 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
1092 /// `lte`, the range is reversed, and the field value must be outside the
1093 /// specified range. If the field value doesn't meet the required conditions,
1094 /// an error message is generated.
1095 ///
1096 /// ```proto
1097 /// message MyUInt64 {
1098 /// // value must be greater than 5 \[uint64.gt\]
1099 /// uint64 value = 1 \[(buf.validate.field).uint64.gt = 5\];
1100 ///
1101 /// // value must be greater than 5 and less than 10 \[uint64.gt_lt\]
1102 /// uint64 other_value = 2 \[(buf.validate.field).uint64 = { gt: 5, lt: 10 }\];
1103 ///
1104 /// // value must be greater than 10 or less than 5 \[uint64.gt_lt_exclusive\]
1105 /// uint64 another_value = 3 \[(buf.validate.field).uint64 = { gt: 10, lt: 5 }\];
1106 /// }
1107 /// ```
1108 #[prost(uint64, tag = "4")]
1109 Gt(u64),
1110 /// `gte` requires the field value to be greater than or equal to the specified
1111 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
1112 /// or `lte`, the range is reversed, and the field value must be outside the
1113 /// specified range. If the field value doesn't meet the required conditions,
1114 /// an error message is generated.
1115 ///
1116 /// ```proto
1117 /// message MyUInt64 {
1118 /// // value must be greater than or equal to 5 \[uint64.gte\]
1119 /// uint64 value = 1 \[(buf.validate.field).uint64.gte = 5\];
1120 ///
1121 /// // value must be greater than or equal to 5 and less than 10 \[uint64.gte_lt\]
1122 /// uint64 other_value = 2 \[(buf.validate.field).uint64 = { gte: 5, lt: 10 }\];
1123 ///
1124 /// // value must be greater than or equal to 10 or less than 5 \[uint64.gte_lt_exclusive\]
1125 /// uint64 another_value = 3 \[(buf.validate.field).uint64 = { gte: 10, lt: 5 }\];
1126 /// }
1127 /// ```
1128 #[prost(uint64, tag = "5")]
1129 Gte(u64),
1130 }
1131}
1132/// SInt32Rules describes the rules applied to `sint32` values.
1133#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1134pub struct SInt32Rules {
1135 /// `const` requires the field value to exactly match the specified value. If
1136 /// the field value doesn't match, an error message is generated.
1137 ///
1138 /// ```proto
1139 /// message MySInt32 {
1140 /// // value must equal 42
1141 /// sint32 value = 1 \[(buf.validate.field).sint32.const = 42\];
1142 /// }
1143 /// ```
1144 #[prost(sint32, optional, tag = "1")]
1145 pub r#const: ::core::option::Option<i32>,
1146 /// `in` requires the field value to be equal to one of the specified values.
1147 /// If the field value isn't one of the specified values, an error message is
1148 /// generated.
1149 ///
1150 /// ```proto
1151 /// message MySInt32 {
1152 /// // value must be in list \[1, 2, 3\]
1153 /// sint32 value = 1 \[(buf.validate.field).sint32 = { in: [1, 2, 3\] }];
1154 /// }
1155 /// ```
1156 #[prost(sint32, repeated, packed = "false", tag = "6")]
1157 pub r#in: ::prost::alloc::vec::Vec<i32>,
1158 /// `not_in` requires the field value to not be equal to any of the specified
1159 /// values. If the field value is one of the specified values, an error
1160 /// message is generated.
1161 ///
1162 /// ```proto
1163 /// message MySInt32 {
1164 /// // value must not be in list \[1, 2, 3\]
1165 /// sint32 value = 1 \[(buf.validate.field).sint32 = { not_in: [1, 2, 3\] }];
1166 /// }
1167 /// ```
1168 #[prost(sint32, repeated, packed = "false", tag = "7")]
1169 pub not_in: ::prost::alloc::vec::Vec<i32>,
1170 /// `example` specifies values that the field may have. These values SHOULD
1171 /// conform to other rules. `example` values will not impact validation
1172 /// but may be used as helpful guidance on how to populate the given field.
1173 ///
1174 /// ```proto
1175 /// message MySInt32 {
1176 /// sint32 value = 1 [
1177 /// (buf.validate.field).sint32.example = 1,
1178 /// (buf.validate.field).sint32.example = -10
1179 /// ];
1180 /// }
1181 /// ```
1182 #[prost(sint32, repeated, packed = "false", tag = "8")]
1183 pub example: ::prost::alloc::vec::Vec<i32>,
1184 #[prost(oneof = "s_int32_rules::LessThan", tags = "2, 3")]
1185 pub less_than: ::core::option::Option<s_int32_rules::LessThan>,
1186 #[prost(oneof = "s_int32_rules::GreaterThan", tags = "4, 5")]
1187 pub greater_than: ::core::option::Option<s_int32_rules::GreaterThan>,
1188}
1189/// Nested message and enum types in `SInt32Rules`.
1190pub mod s_int32_rules {
1191 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1192 pub enum LessThan {
1193 /// `lt` requires the field value to be less than the specified value (field
1194 /// < value). If the field value is equal to or greater than the specified
1195 /// value, an error message is generated.
1196 ///
1197 /// ```proto
1198 /// message MySInt32 {
1199 /// // value must be less than 10
1200 /// sint32 value = 1 \[(buf.validate.field).sint32.lt = 10\];
1201 /// }
1202 /// ```
1203 #[prost(sint32, tag = "2")]
1204 Lt(i32),
1205 /// `lte` requires the field value to be less than or equal to the specified
1206 /// value (field <= value). If the field value is greater than the specified
1207 /// value, an error message is generated.
1208 ///
1209 /// ```proto
1210 /// message MySInt32 {
1211 /// // value must be less than or equal to 10
1212 /// sint32 value = 1 \[(buf.validate.field).sint32.lte = 10\];
1213 /// }
1214 /// ```
1215 #[prost(sint32, tag = "3")]
1216 Lte(i32),
1217 }
1218 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1219 pub enum GreaterThan {
1220 /// `gt` requires the field value to be greater than the specified value
1221 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
1222 /// `lte`, the range is reversed, and the field value must be outside the
1223 /// specified range. If the field value doesn't meet the required conditions,
1224 /// an error message is generated.
1225 ///
1226 /// ```proto
1227 /// message MySInt32 {
1228 /// // value must be greater than 5 \[sint32.gt\]
1229 /// sint32 value = 1 \[(buf.validate.field).sint32.gt = 5\];
1230 ///
1231 /// // value must be greater than 5 and less than 10 \[sint32.gt_lt\]
1232 /// sint32 other_value = 2 \[(buf.validate.field).sint32 = { gt: 5, lt: 10 }\];
1233 ///
1234 /// // value must be greater than 10 or less than 5 \[sint32.gt_lt_exclusive\]
1235 /// sint32 another_value = 3 \[(buf.validate.field).sint32 = { gt: 10, lt: 5 }\];
1236 /// }
1237 /// ```
1238 #[prost(sint32, tag = "4")]
1239 Gt(i32),
1240 /// `gte` requires the field value to be greater than or equal to the specified
1241 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
1242 /// or `lte`, the range is reversed, and the field value must be outside the
1243 /// specified range. If the field value doesn't meet the required conditions,
1244 /// an error message is generated.
1245 ///
1246 /// ```proto
1247 /// message MySInt32 {
1248 /// // value must be greater than or equal to 5 \[sint32.gte\]
1249 /// sint32 value = 1 \[(buf.validate.field).sint32.gte = 5\];
1250 ///
1251 /// // value must be greater than or equal to 5 and less than 10 \[sint32.gte_lt\]
1252 /// sint32 other_value = 2 \[(buf.validate.field).sint32 = { gte: 5, lt: 10 }\];
1253 ///
1254 /// // value must be greater than or equal to 10 or less than 5 \[sint32.gte_lt_exclusive\]
1255 /// sint32 another_value = 3 \[(buf.validate.field).sint32 = { gte: 10, lt: 5 }\];
1256 /// }
1257 /// ```
1258 #[prost(sint32, tag = "5")]
1259 Gte(i32),
1260 }
1261}
1262/// SInt64Rules describes the rules applied to `sint64` values.
1263#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1264pub struct SInt64Rules {
1265 /// `const` requires the field value to exactly match the specified value. If
1266 /// the field value doesn't match, an error message is generated.
1267 ///
1268 /// ```proto
1269 /// message MySInt64 {
1270 /// // value must equal 42
1271 /// sint64 value = 1 \[(buf.validate.field).sint64.const = 42\];
1272 /// }
1273 /// ```
1274 #[prost(sint64, optional, tag = "1")]
1275 pub r#const: ::core::option::Option<i64>,
1276 /// `in` requires the field value to be equal to one of the specified values.
1277 /// If the field value isn't one of the specified values, an error message
1278 /// is generated.
1279 ///
1280 /// ```proto
1281 /// message MySInt64 {
1282 /// // value must be in list \[1, 2, 3\]
1283 /// sint64 value = 1 \[(buf.validate.field).sint64 = { in: [1, 2, 3\] }];
1284 /// }
1285 /// ```
1286 #[prost(sint64, repeated, packed = "false", tag = "6")]
1287 pub r#in: ::prost::alloc::vec::Vec<i64>,
1288 /// `not_in` requires the field value to not be equal to any of the specified
1289 /// values. If the field value is one of the specified values, an error
1290 /// message is generated.
1291 ///
1292 /// ```proto
1293 /// message MySInt64 {
1294 /// // value must not be in list \[1, 2, 3\]
1295 /// sint64 value = 1 \[(buf.validate.field).sint64 = { not_in: [1, 2, 3\] }];
1296 /// }
1297 /// ```
1298 #[prost(sint64, repeated, packed = "false", tag = "7")]
1299 pub not_in: ::prost::alloc::vec::Vec<i64>,
1300 /// `example` specifies values that the field may have. These values SHOULD
1301 /// conform to other rules. `example` values will not impact validation
1302 /// but may be used as helpful guidance on how to populate the given field.
1303 ///
1304 /// ```proto
1305 /// message MySInt64 {
1306 /// sint64 value = 1 [
1307 /// (buf.validate.field).sint64.example = 1,
1308 /// (buf.validate.field).sint64.example = -10
1309 /// ];
1310 /// }
1311 /// ```
1312 #[prost(sint64, repeated, packed = "false", tag = "8")]
1313 pub example: ::prost::alloc::vec::Vec<i64>,
1314 #[prost(oneof = "s_int64_rules::LessThan", tags = "2, 3")]
1315 pub less_than: ::core::option::Option<s_int64_rules::LessThan>,
1316 #[prost(oneof = "s_int64_rules::GreaterThan", tags = "4, 5")]
1317 pub greater_than: ::core::option::Option<s_int64_rules::GreaterThan>,
1318}
1319/// Nested message and enum types in `SInt64Rules`.
1320pub mod s_int64_rules {
1321 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1322 pub enum LessThan {
1323 /// `lt` requires the field value to be less than the specified value (field
1324 /// < value). If the field value is equal to or greater than the specified
1325 /// value, an error message is generated.
1326 ///
1327 /// ```proto
1328 /// message MySInt64 {
1329 /// // value must be less than 10
1330 /// sint64 value = 1 \[(buf.validate.field).sint64.lt = 10\];
1331 /// }
1332 /// ```
1333 #[prost(sint64, tag = "2")]
1334 Lt(i64),
1335 /// `lte` requires the field value to be less than or equal to the specified
1336 /// value (field <= value). If the field value is greater than the specified
1337 /// value, an error message is generated.
1338 ///
1339 /// ```proto
1340 /// message MySInt64 {
1341 /// // value must be less than or equal to 10
1342 /// sint64 value = 1 \[(buf.validate.field).sint64.lte = 10\];
1343 /// }
1344 /// ```
1345 #[prost(sint64, tag = "3")]
1346 Lte(i64),
1347 }
1348 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1349 pub enum GreaterThan {
1350 /// `gt` requires the field value to be greater than the specified value
1351 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
1352 /// `lte`, the range is reversed, and the field value must be outside the
1353 /// specified range. If the field value doesn't meet the required conditions,
1354 /// an error message is generated.
1355 ///
1356 /// ```proto
1357 /// message MySInt64 {
1358 /// // value must be greater than 5 \[sint64.gt\]
1359 /// sint64 value = 1 \[(buf.validate.field).sint64.gt = 5\];
1360 ///
1361 /// // value must be greater than 5 and less than 10 \[sint64.gt_lt\]
1362 /// sint64 other_value = 2 \[(buf.validate.field).sint64 = { gt: 5, lt: 10 }\];
1363 ///
1364 /// // value must be greater than 10 or less than 5 \[sint64.gt_lt_exclusive\]
1365 /// sint64 another_value = 3 \[(buf.validate.field).sint64 = { gt: 10, lt: 5 }\];
1366 /// }
1367 /// ```
1368 #[prost(sint64, tag = "4")]
1369 Gt(i64),
1370 /// `gte` requires the field value to be greater than or equal to the specified
1371 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
1372 /// or `lte`, the range is reversed, and the field value must be outside the
1373 /// specified range. If the field value doesn't meet the required conditions,
1374 /// an error message is generated.
1375 ///
1376 /// ```proto
1377 /// message MySInt64 {
1378 /// // value must be greater than or equal to 5 \[sint64.gte\]
1379 /// sint64 value = 1 \[(buf.validate.field).sint64.gte = 5\];
1380 ///
1381 /// // value must be greater than or equal to 5 and less than 10 \[sint64.gte_lt\]
1382 /// sint64 other_value = 2 \[(buf.validate.field).sint64 = { gte: 5, lt: 10 }\];
1383 ///
1384 /// // value must be greater than or equal to 10 or less than 5 \[sint64.gte_lt_exclusive\]
1385 /// sint64 another_value = 3 \[(buf.validate.field).sint64 = { gte: 10, lt: 5 }\];
1386 /// }
1387 /// ```
1388 #[prost(sint64, tag = "5")]
1389 Gte(i64),
1390 }
1391}
1392/// Fixed32Rules describes the rules applied to `fixed32` values.
1393#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1394pub struct Fixed32Rules {
1395 /// `const` requires the field value to exactly match the specified value.
1396 /// If the field value doesn't match, an error message is generated.
1397 ///
1398 /// ```proto
1399 /// message MyFixed32 {
1400 /// // value must equal 42
1401 /// fixed32 value = 1 \[(buf.validate.field).fixed32.const = 42\];
1402 /// }
1403 /// ```
1404 #[prost(fixed32, optional, tag = "1")]
1405 pub r#const: ::core::option::Option<u32>,
1406 /// `in` requires the field value to be equal to one of the specified values.
1407 /// If the field value isn't one of the specified values, an error message
1408 /// is generated.
1409 ///
1410 /// ```proto
1411 /// message MyFixed32 {
1412 /// // value must be in list \[1, 2, 3\]
1413 /// fixed32 value = 1 \[(buf.validate.field).fixed32 = { in: [1, 2, 3\] }];
1414 /// }
1415 /// ```
1416 #[prost(fixed32, repeated, packed = "false", tag = "6")]
1417 pub r#in: ::prost::alloc::vec::Vec<u32>,
1418 /// `not_in` requires the field value to not be equal to any of the specified
1419 /// values. If the field value is one of the specified values, an error
1420 /// message is generated.
1421 ///
1422 /// ```proto
1423 /// message MyFixed32 {
1424 /// // value must not be in list \[1, 2, 3\]
1425 /// fixed32 value = 1 \[(buf.validate.field).fixed32 = { not_in: [1, 2, 3\] }];
1426 /// }
1427 /// ```
1428 #[prost(fixed32, repeated, packed = "false", tag = "7")]
1429 pub not_in: ::prost::alloc::vec::Vec<u32>,
1430 /// `example` specifies values that the field may have. These values SHOULD
1431 /// conform to other rules. `example` values will not impact validation
1432 /// but may be used as helpful guidance on how to populate the given field.
1433 ///
1434 /// ```proto
1435 /// message MyFixed32 {
1436 /// fixed32 value = 1 [
1437 /// (buf.validate.field).fixed32.example = 1,
1438 /// (buf.validate.field).fixed32.example = 2
1439 /// ];
1440 /// }
1441 /// ```
1442 #[prost(fixed32, repeated, packed = "false", tag = "8")]
1443 pub example: ::prost::alloc::vec::Vec<u32>,
1444 #[prost(oneof = "fixed32_rules::LessThan", tags = "2, 3")]
1445 pub less_than: ::core::option::Option<fixed32_rules::LessThan>,
1446 #[prost(oneof = "fixed32_rules::GreaterThan", tags = "4, 5")]
1447 pub greater_than: ::core::option::Option<fixed32_rules::GreaterThan>,
1448}
1449/// Nested message and enum types in `Fixed32Rules`.
1450pub mod fixed32_rules {
1451 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1452 pub enum LessThan {
1453 /// `lt` requires the field value to be less than the specified value (field <
1454 /// value). If the field value is equal to or greater than the specified value,
1455 /// an error message is generated.
1456 ///
1457 /// ```proto
1458 /// message MyFixed32 {
1459 /// // value must be less than 10
1460 /// fixed32 value = 1 \[(buf.validate.field).fixed32.lt = 10\];
1461 /// }
1462 /// ```
1463 #[prost(fixed32, tag = "2")]
1464 Lt(u32),
1465 /// `lte` requires the field value to be less than or equal to the specified
1466 /// value (field <= value). If the field value is greater than the specified
1467 /// value, an error message is generated.
1468 ///
1469 /// ```proto
1470 /// message MyFixed32 {
1471 /// // value must be less than or equal to 10
1472 /// fixed32 value = 1 \[(buf.validate.field).fixed32.lte = 10\];
1473 /// }
1474 /// ```
1475 #[prost(fixed32, tag = "3")]
1476 Lte(u32),
1477 }
1478 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1479 pub enum GreaterThan {
1480 /// `gt` requires the field value to be greater than the specified value
1481 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
1482 /// `lte`, the range is reversed, and the field value must be outside the
1483 /// specified range. If the field value doesn't meet the required conditions,
1484 /// an error message is generated.
1485 ///
1486 /// ```proto
1487 /// message MyFixed32 {
1488 /// // value must be greater than 5 \[fixed32.gt\]
1489 /// fixed32 value = 1 \[(buf.validate.field).fixed32.gt = 5\];
1490 ///
1491 /// // value must be greater than 5 and less than 10 \[fixed32.gt_lt\]
1492 /// fixed32 other_value = 2 \[(buf.validate.field).fixed32 = { gt: 5, lt: 10 }\];
1493 ///
1494 /// // value must be greater than 10 or less than 5 \[fixed32.gt_lt_exclusive\]
1495 /// fixed32 another_value = 3 \[(buf.validate.field).fixed32 = { gt: 10, lt: 5 }\];
1496 /// }
1497 /// ```
1498 #[prost(fixed32, tag = "4")]
1499 Gt(u32),
1500 /// `gte` requires the field value to be greater than or equal to the specified
1501 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
1502 /// or `lte`, the range is reversed, and the field value must be outside the
1503 /// specified range. If the field value doesn't meet the required conditions,
1504 /// an error message is generated.
1505 ///
1506 /// ```proto
1507 /// message MyFixed32 {
1508 /// // value must be greater than or equal to 5 \[fixed32.gte\]
1509 /// fixed32 value = 1 \[(buf.validate.field).fixed32.gte = 5\];
1510 ///
1511 /// // value must be greater than or equal to 5 and less than 10 \[fixed32.gte_lt\]
1512 /// fixed32 other_value = 2 \[(buf.validate.field).fixed32 = { gte: 5, lt: 10 }\];
1513 ///
1514 /// // value must be greater than or equal to 10 or less than 5 \[fixed32.gte_lt_exclusive\]
1515 /// fixed32 another_value = 3 \[(buf.validate.field).fixed32 = { gte: 10, lt: 5 }\];
1516 /// }
1517 /// ```
1518 #[prost(fixed32, tag = "5")]
1519 Gte(u32),
1520 }
1521}
1522/// Fixed64Rules describes the rules applied to `fixed64` values.
1523#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1524pub struct Fixed64Rules {
1525 /// `const` requires the field value to exactly match the specified value. If
1526 /// the field value doesn't match, an error message is generated.
1527 ///
1528 /// ```proto
1529 /// message MyFixed64 {
1530 /// // value must equal 42
1531 /// fixed64 value = 1 \[(buf.validate.field).fixed64.const = 42\];
1532 /// }
1533 /// ```
1534 #[prost(fixed64, optional, tag = "1")]
1535 pub r#const: ::core::option::Option<u64>,
1536 /// `in` requires the field value to be equal to one of the specified values.
1537 /// If the field value isn't one of the specified values, an error message is
1538 /// generated.
1539 ///
1540 /// ```proto
1541 /// message MyFixed64 {
1542 /// // value must be in list \[1, 2, 3\]
1543 /// fixed64 value = 1 \[(buf.validate.field).fixed64 = { in: [1, 2, 3\] }];
1544 /// }
1545 /// ```
1546 #[prost(fixed64, repeated, packed = "false", tag = "6")]
1547 pub r#in: ::prost::alloc::vec::Vec<u64>,
1548 /// `not_in` requires the field value to not be equal to any of the specified
1549 /// values. If the field value is one of the specified values, an error
1550 /// message is generated.
1551 ///
1552 /// ```proto
1553 /// message MyFixed64 {
1554 /// // value must not be in list \[1, 2, 3\]
1555 /// fixed64 value = 1 \[(buf.validate.field).fixed64 = { not_in: [1, 2, 3\] }];
1556 /// }
1557 /// ```
1558 #[prost(fixed64, repeated, packed = "false", tag = "7")]
1559 pub not_in: ::prost::alloc::vec::Vec<u64>,
1560 /// `example` specifies values that the field may have. These values SHOULD
1561 /// conform to other rules. `example` values will not impact validation
1562 /// but may be used as helpful guidance on how to populate the given field.
1563 ///
1564 /// ```proto
1565 /// message MyFixed64 {
1566 /// fixed64 value = 1 [
1567 /// (buf.validate.field).fixed64.example = 1,
1568 /// (buf.validate.field).fixed64.example = 2
1569 /// ];
1570 /// }
1571 /// ```
1572 #[prost(fixed64, repeated, packed = "false", tag = "8")]
1573 pub example: ::prost::alloc::vec::Vec<u64>,
1574 #[prost(oneof = "fixed64_rules::LessThan", tags = "2, 3")]
1575 pub less_than: ::core::option::Option<fixed64_rules::LessThan>,
1576 #[prost(oneof = "fixed64_rules::GreaterThan", tags = "4, 5")]
1577 pub greater_than: ::core::option::Option<fixed64_rules::GreaterThan>,
1578}
1579/// Nested message and enum types in `Fixed64Rules`.
1580pub mod fixed64_rules {
1581 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1582 pub enum LessThan {
1583 /// `lt` requires the field value to be less than the specified value (field <
1584 /// value). If the field value is equal to or greater than the specified value,
1585 /// an error message is generated.
1586 ///
1587 /// ```proto
1588 /// message MyFixed64 {
1589 /// // value must be less than 10
1590 /// fixed64 value = 1 \[(buf.validate.field).fixed64.lt = 10\];
1591 /// }
1592 /// ```
1593 #[prost(fixed64, tag = "2")]
1594 Lt(u64),
1595 /// `lte` requires the field value to be less than or equal to the specified
1596 /// value (field <= value). If the field value is greater than the specified
1597 /// value, an error message is generated.
1598 ///
1599 /// ```proto
1600 /// message MyFixed64 {
1601 /// // value must be less than or equal to 10
1602 /// fixed64 value = 1 \[(buf.validate.field).fixed64.lte = 10\];
1603 /// }
1604 /// ```
1605 #[prost(fixed64, tag = "3")]
1606 Lte(u64),
1607 }
1608 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1609 pub enum GreaterThan {
1610 /// `gt` requires the field value to be greater than the specified value
1611 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
1612 /// `lte`, the range is reversed, and the field value must be outside the
1613 /// specified range. If the field value doesn't meet the required conditions,
1614 /// an error message is generated.
1615 ///
1616 /// ```proto
1617 /// message MyFixed64 {
1618 /// // value must be greater than 5 \[fixed64.gt\]
1619 /// fixed64 value = 1 \[(buf.validate.field).fixed64.gt = 5\];
1620 ///
1621 /// // value must be greater than 5 and less than 10 \[fixed64.gt_lt\]
1622 /// fixed64 other_value = 2 \[(buf.validate.field).fixed64 = { gt: 5, lt: 10 }\];
1623 ///
1624 /// // value must be greater than 10 or less than 5 \[fixed64.gt_lt_exclusive\]
1625 /// fixed64 another_value = 3 \[(buf.validate.field).fixed64 = { gt: 10, lt: 5 }\];
1626 /// }
1627 /// ```
1628 #[prost(fixed64, tag = "4")]
1629 Gt(u64),
1630 /// `gte` requires the field value to be greater than or equal to the specified
1631 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
1632 /// or `lte`, the range is reversed, and the field value must be outside the
1633 /// specified range. If the field value doesn't meet the required conditions,
1634 /// an error message is generated.
1635 ///
1636 /// ```proto
1637 /// message MyFixed64 {
1638 /// // value must be greater than or equal to 5 \[fixed64.gte\]
1639 /// fixed64 value = 1 \[(buf.validate.field).fixed64.gte = 5\];
1640 ///
1641 /// // value must be greater than or equal to 5 and less than 10 \[fixed64.gte_lt\]
1642 /// fixed64 other_value = 2 \[(buf.validate.field).fixed64 = { gte: 5, lt: 10 }\];
1643 ///
1644 /// // value must be greater than or equal to 10 or less than 5 \[fixed64.gte_lt_exclusive\]
1645 /// fixed64 another_value = 3 \[(buf.validate.field).fixed64 = { gte: 10, lt: 5 }\];
1646 /// }
1647 /// ```
1648 #[prost(fixed64, tag = "5")]
1649 Gte(u64),
1650 }
1651}
1652/// SFixed32Rules describes the rules applied to `fixed32` values.
1653#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1654pub struct SFixed32Rules {
1655 /// `const` requires the field value to exactly match the specified value. If
1656 /// the field value doesn't match, an error message is generated.
1657 ///
1658 /// ```proto
1659 /// message MySFixed32 {
1660 /// // value must equal 42
1661 /// sfixed32 value = 1 \[(buf.validate.field).sfixed32.const = 42\];
1662 /// }
1663 /// ```
1664 #[prost(sfixed32, optional, tag = "1")]
1665 pub r#const: ::core::option::Option<i32>,
1666 /// `in` requires the field value to be equal to one of the specified values.
1667 /// If the field value isn't one of the specified values, an error message is
1668 /// generated.
1669 ///
1670 /// ```proto
1671 /// message MySFixed32 {
1672 /// // value must be in list \[1, 2, 3\]
1673 /// sfixed32 value = 1 \[(buf.validate.field).sfixed32 = { in: [1, 2, 3\] }];
1674 /// }
1675 /// ```
1676 #[prost(sfixed32, repeated, packed = "false", tag = "6")]
1677 pub r#in: ::prost::alloc::vec::Vec<i32>,
1678 /// `not_in` requires the field value to not be equal to any of the specified
1679 /// values. If the field value is one of the specified values, an error
1680 /// message is generated.
1681 ///
1682 /// ```proto
1683 /// message MySFixed32 {
1684 /// // value must not be in list \[1, 2, 3\]
1685 /// sfixed32 value = 1 \[(buf.validate.field).sfixed32 = { not_in: [1, 2, 3\] }];
1686 /// }
1687 /// ```
1688 #[prost(sfixed32, repeated, packed = "false", tag = "7")]
1689 pub not_in: ::prost::alloc::vec::Vec<i32>,
1690 /// `example` specifies values that the field may have. These values SHOULD
1691 /// conform to other rules. `example` values will not impact validation
1692 /// but may be used as helpful guidance on how to populate the given field.
1693 ///
1694 /// ```proto
1695 /// message MySFixed32 {
1696 /// sfixed32 value = 1 [
1697 /// (buf.validate.field).sfixed32.example = 1,
1698 /// (buf.validate.field).sfixed32.example = 2
1699 /// ];
1700 /// }
1701 /// ```
1702 #[prost(sfixed32, repeated, packed = "false", tag = "8")]
1703 pub example: ::prost::alloc::vec::Vec<i32>,
1704 #[prost(oneof = "s_fixed32_rules::LessThan", tags = "2, 3")]
1705 pub less_than: ::core::option::Option<s_fixed32_rules::LessThan>,
1706 #[prost(oneof = "s_fixed32_rules::GreaterThan", tags = "4, 5")]
1707 pub greater_than: ::core::option::Option<s_fixed32_rules::GreaterThan>,
1708}
1709/// Nested message and enum types in `SFixed32Rules`.
1710pub mod s_fixed32_rules {
1711 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1712 pub enum LessThan {
1713 /// `lt` requires the field value to be less than the specified value (field <
1714 /// value). If the field value is equal to or greater than the specified value,
1715 /// an error message is generated.
1716 ///
1717 /// ```proto
1718 /// message MySFixed32 {
1719 /// // value must be less than 10
1720 /// sfixed32 value = 1 \[(buf.validate.field).sfixed32.lt = 10\];
1721 /// }
1722 /// ```
1723 #[prost(sfixed32, tag = "2")]
1724 Lt(i32),
1725 /// `lte` requires the field value to be less than or equal to the specified
1726 /// value (field <= value). If the field value is greater than the specified
1727 /// value, an error message is generated.
1728 ///
1729 /// ```proto
1730 /// message MySFixed32 {
1731 /// // value must be less than or equal to 10
1732 /// sfixed32 value = 1 \[(buf.validate.field).sfixed32.lte = 10\];
1733 /// }
1734 /// ```
1735 #[prost(sfixed32, tag = "3")]
1736 Lte(i32),
1737 }
1738 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1739 pub enum GreaterThan {
1740 /// `gt` requires the field value to be greater than the specified value
1741 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
1742 /// `lte`, the range is reversed, and the field value must be outside the
1743 /// specified range. If the field value doesn't meet the required conditions,
1744 /// an error message is generated.
1745 ///
1746 /// ```proto
1747 /// message MySFixed32 {
1748 /// // value must be greater than 5 \[sfixed32.gt\]
1749 /// sfixed32 value = 1 \[(buf.validate.field).sfixed32.gt = 5\];
1750 ///
1751 /// // value must be greater than 5 and less than 10 \[sfixed32.gt_lt\]
1752 /// sfixed32 other_value = 2 \[(buf.validate.field).sfixed32 = { gt: 5, lt: 10 }\];
1753 ///
1754 /// // value must be greater than 10 or less than 5 \[sfixed32.gt_lt_exclusive\]
1755 /// sfixed32 another_value = 3 \[(buf.validate.field).sfixed32 = { gt: 10, lt: 5 }\];
1756 /// }
1757 /// ```
1758 #[prost(sfixed32, tag = "4")]
1759 Gt(i32),
1760 /// `gte` requires the field value to be greater than or equal to the specified
1761 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
1762 /// or `lte`, the range is reversed, and the field value must be outside the
1763 /// specified range. If the field value doesn't meet the required conditions,
1764 /// an error message is generated.
1765 ///
1766 /// ```proto
1767 /// message MySFixed32 {
1768 /// // value must be greater than or equal to 5 \[sfixed32.gte\]
1769 /// sfixed32 value = 1 \[(buf.validate.field).sfixed32.gte = 5\];
1770 ///
1771 /// // value must be greater than or equal to 5 and less than 10 \[sfixed32.gte_lt\]
1772 /// sfixed32 other_value = 2 \[(buf.validate.field).sfixed32 = { gte: 5, lt: 10 }\];
1773 ///
1774 /// // value must be greater than or equal to 10 or less than 5 \[sfixed32.gte_lt_exclusive\]
1775 /// sfixed32 another_value = 3 \[(buf.validate.field).sfixed32 = { gte: 10, lt: 5 }\];
1776 /// }
1777 /// ```
1778 #[prost(sfixed32, tag = "5")]
1779 Gte(i32),
1780 }
1781}
1782/// SFixed64Rules describes the rules applied to `fixed64` values.
1783#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1784pub struct SFixed64Rules {
1785 /// `const` requires the field value to exactly match the specified value. If
1786 /// the field value doesn't match, an error message is generated.
1787 ///
1788 /// ```proto
1789 /// message MySFixed64 {
1790 /// // value must equal 42
1791 /// sfixed64 value = 1 \[(buf.validate.field).sfixed64.const = 42\];
1792 /// }
1793 /// ```
1794 #[prost(sfixed64, optional, tag = "1")]
1795 pub r#const: ::core::option::Option<i64>,
1796 /// `in` requires the field value to be equal to one of the specified values.
1797 /// If the field value isn't one of the specified values, an error message is
1798 /// generated.
1799 ///
1800 /// ```proto
1801 /// message MySFixed64 {
1802 /// // value must be in list \[1, 2, 3\]
1803 /// sfixed64 value = 1 \[(buf.validate.field).sfixed64 = { in: [1, 2, 3\] }];
1804 /// }
1805 /// ```
1806 #[prost(sfixed64, repeated, packed = "false", tag = "6")]
1807 pub r#in: ::prost::alloc::vec::Vec<i64>,
1808 /// `not_in` requires the field value to not be equal to any of the specified
1809 /// values. If the field value is one of the specified values, an error
1810 /// message is generated.
1811 ///
1812 /// ```proto
1813 /// message MySFixed64 {
1814 /// // value must not be in list \[1, 2, 3\]
1815 /// sfixed64 value = 1 \[(buf.validate.field).sfixed64 = { not_in: [1, 2, 3\] }];
1816 /// }
1817 /// ```
1818 #[prost(sfixed64, repeated, packed = "false", tag = "7")]
1819 pub not_in: ::prost::alloc::vec::Vec<i64>,
1820 /// `example` specifies values that the field may have. These values SHOULD
1821 /// conform to other rules. `example` values will not impact validation
1822 /// but may be used as helpful guidance on how to populate the given field.
1823 ///
1824 /// ```proto
1825 /// message MySFixed64 {
1826 /// sfixed64 value = 1 [
1827 /// (buf.validate.field).sfixed64.example = 1,
1828 /// (buf.validate.field).sfixed64.example = 2
1829 /// ];
1830 /// }
1831 /// ```
1832 #[prost(sfixed64, repeated, packed = "false", tag = "8")]
1833 pub example: ::prost::alloc::vec::Vec<i64>,
1834 #[prost(oneof = "s_fixed64_rules::LessThan", tags = "2, 3")]
1835 pub less_than: ::core::option::Option<s_fixed64_rules::LessThan>,
1836 #[prost(oneof = "s_fixed64_rules::GreaterThan", tags = "4, 5")]
1837 pub greater_than: ::core::option::Option<s_fixed64_rules::GreaterThan>,
1838}
1839/// Nested message and enum types in `SFixed64Rules`.
1840pub mod s_fixed64_rules {
1841 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1842 pub enum LessThan {
1843 /// `lt` requires the field value to be less than the specified value (field <
1844 /// value). If the field value is equal to or greater than the specified value,
1845 /// an error message is generated.
1846 ///
1847 /// ```proto
1848 /// message MySFixed64 {
1849 /// // value must be less than 10
1850 /// sfixed64 value = 1 \[(buf.validate.field).sfixed64.lt = 10\];
1851 /// }
1852 /// ```
1853 #[prost(sfixed64, tag = "2")]
1854 Lt(i64),
1855 /// `lte` requires the field value to be less than or equal to the specified
1856 /// value (field <= value). If the field value is greater than the specified
1857 /// value, an error message is generated.
1858 ///
1859 /// ```proto
1860 /// message MySFixed64 {
1861 /// // value must be less than or equal to 10
1862 /// sfixed64 value = 1 \[(buf.validate.field).sfixed64.lte = 10\];
1863 /// }
1864 /// ```
1865 #[prost(sfixed64, tag = "3")]
1866 Lte(i64),
1867 }
1868 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1869 pub enum GreaterThan {
1870 /// `gt` requires the field value to be greater than the specified value
1871 /// (exclusive). If the value of `gt` is larger than a specified `lt` or
1872 /// `lte`, the range is reversed, and the field value must be outside the
1873 /// specified range. If the field value doesn't meet the required conditions,
1874 /// an error message is generated.
1875 ///
1876 /// ```proto
1877 /// message MySFixed64 {
1878 /// // value must be greater than 5 \[sfixed64.gt\]
1879 /// sfixed64 value = 1 \[(buf.validate.field).sfixed64.gt = 5\];
1880 ///
1881 /// // value must be greater than 5 and less than 10 \[sfixed64.gt_lt\]
1882 /// sfixed64 other_value = 2 \[(buf.validate.field).sfixed64 = { gt: 5, lt: 10 }\];
1883 ///
1884 /// // value must be greater than 10 or less than 5 \[sfixed64.gt_lt_exclusive\]
1885 /// sfixed64 another_value = 3 \[(buf.validate.field).sfixed64 = { gt: 10, lt: 5 }\];
1886 /// }
1887 /// ```
1888 #[prost(sfixed64, tag = "4")]
1889 Gt(i64),
1890 /// `gte` requires the field value to be greater than or equal to the specified
1891 /// value (exclusive). If the value of `gte` is larger than a specified `lt`
1892 /// or `lte`, the range is reversed, and the field value must be outside the
1893 /// specified range. If the field value doesn't meet the required conditions,
1894 /// an error message is generated.
1895 ///
1896 /// ```proto
1897 /// message MySFixed64 {
1898 /// // value must be greater than or equal to 5 \[sfixed64.gte\]
1899 /// sfixed64 value = 1 \[(buf.validate.field).sfixed64.gte = 5\];
1900 ///
1901 /// // value must be greater than or equal to 5 and less than 10 \[sfixed64.gte_lt\]
1902 /// sfixed64 other_value = 2 \[(buf.validate.field).sfixed64 = { gte: 5, lt: 10 }\];
1903 ///
1904 /// // value must be greater than or equal to 10 or less than 5 \[sfixed64.gte_lt_exclusive\]
1905 /// sfixed64 another_value = 3 \[(buf.validate.field).sfixed64 = { gte: 10, lt: 5 }\];
1906 /// }
1907 /// ```
1908 #[prost(sfixed64, tag = "5")]
1909 Gte(i64),
1910 }
1911}
1912/// BoolRules describes the rules applied to `bool` values. These rules
1913/// may also be applied to the `google.protobuf.BoolValue` Well-Known-Type.
1914#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1915pub struct BoolRules {
1916 /// `const` requires the field value to exactly match the specified boolean value.
1917 /// If the field value doesn't match, an error message is generated.
1918 ///
1919 /// ```proto
1920 /// message MyBool {
1921 /// // value must equal true
1922 /// bool value = 1 \[(buf.validate.field).bool.const = true\];
1923 /// }
1924 /// ```
1925 #[prost(bool, optional, tag = "1")]
1926 pub r#const: ::core::option::Option<bool>,
1927 /// `example` specifies values that the field may have. These values SHOULD
1928 /// conform to other rules. `example` values will not impact validation
1929 /// but may be used as helpful guidance on how to populate the given field.
1930 ///
1931 /// ```proto
1932 /// message MyBool {
1933 /// bool value = 1 [
1934 /// (buf.validate.field).bool.example = 1,
1935 /// (buf.validate.field).bool.example = 2
1936 /// ];
1937 /// }
1938 /// ```
1939 #[prost(bool, repeated, packed = "false", tag = "2")]
1940 pub example: ::prost::alloc::vec::Vec<bool>,
1941}
1942/// StringRules describes the rules applied to `string` values These
1943/// rules may also be applied to the `google.protobuf.StringValue` Well-Known-Type.
1944#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1945pub struct StringRules {
1946 /// `const` requires the field value to exactly match the specified value. If
1947 /// the field value doesn't match, an error message is generated.
1948 ///
1949 /// ```proto
1950 /// message MyString {
1951 /// // value must equal `hello`
1952 /// string value = 1 \[(buf.validate.field).string.const = "hello"\];
1953 /// }
1954 /// ```
1955 #[prost(string, optional, tag = "1")]
1956 pub r#const: ::core::option::Option<::prost::alloc::string::String>,
1957 /// `len` dictates that the field value must have the specified
1958 /// number of characters (Unicode code points), which may differ from the number
1959 /// of bytes in the string. If the field value does not meet the specified
1960 /// length, an error message will be generated.
1961 ///
1962 /// ```proto
1963 /// message MyString {
1964 /// // value length must be 5 characters
1965 /// string value = 1 \[(buf.validate.field).string.len = 5\];
1966 /// }
1967 /// ```
1968 #[prost(uint64, optional, tag = "19")]
1969 pub len: ::core::option::Option<u64>,
1970 /// `min_len` specifies that the field value must have at least the specified
1971 /// number of characters (Unicode code points), which may differ from the number
1972 /// of bytes in the string. If the field value contains fewer characters, an error
1973 /// message will be generated.
1974 ///
1975 /// ```proto
1976 /// message MyString {
1977 /// // value length must be at least 3 characters
1978 /// string value = 1 \[(buf.validate.field).string.min_len = 3\];
1979 /// }
1980 /// ```
1981 #[prost(uint64, optional, tag = "2")]
1982 pub min_len: ::core::option::Option<u64>,
1983 /// `max_len` specifies that the field value must have no more than the specified
1984 /// number of characters (Unicode code points), which may differ from the
1985 /// number of bytes in the string. If the field value contains more characters,
1986 /// an error message will be generated.
1987 ///
1988 /// ```proto
1989 /// message MyString {
1990 /// // value length must be at most 10 characters
1991 /// string value = 1 \[(buf.validate.field).string.max_len = 10\];
1992 /// }
1993 /// ```
1994 #[prost(uint64, optional, tag = "3")]
1995 pub max_len: ::core::option::Option<u64>,
1996 /// `len_bytes` dictates that the field value must have the specified number of
1997 /// bytes. If the field value does not match the specified length in bytes,
1998 /// an error message will be generated.
1999 ///
2000 /// ```proto
2001 /// message MyString {
2002 /// // value length must be 6 bytes
2003 /// string value = 1 \[(buf.validate.field).string.len_bytes = 6\];
2004 /// }
2005 /// ```
2006 #[prost(uint64, optional, tag = "20")]
2007 pub len_bytes: ::core::option::Option<u64>,
2008 /// `min_bytes` specifies that the field value must have at least the specified
2009 /// number of bytes. If the field value contains fewer bytes, an error message
2010 /// will be generated.
2011 ///
2012 /// ```proto
2013 /// message MyString {
2014 /// // value length must be at least 4 bytes
2015 /// string value = 1 \[(buf.validate.field).string.min_bytes = 4\];
2016 /// }
2017 ///
2018 /// ```
2019 #[prost(uint64, optional, tag = "4")]
2020 pub min_bytes: ::core::option::Option<u64>,
2021 /// `max_bytes` specifies that the field value must have no more than the
2022 /// specified number of bytes. If the field value contains more bytes, an
2023 /// error message will be generated.
2024 ///
2025 /// ```proto
2026 /// message MyString {
2027 /// // value length must be at most 8 bytes
2028 /// string value = 1 \[(buf.validate.field).string.max_bytes = 8\];
2029 /// }
2030 /// ```
2031 #[prost(uint64, optional, tag = "5")]
2032 pub max_bytes: ::core::option::Option<u64>,
2033 /// `pattern` specifies that the field value must match the specified
2034 /// regular expression (RE2 syntax), with the expression provided without any
2035 /// delimiters. If the field value doesn't match the regular expression, an
2036 /// error message will be generated.
2037 ///
2038 /// ```proto
2039 /// message MyString {
2040 /// // value does not match regex pattern `^\[a-zA-Z\]//$`
2041 /// string value = 1 \[(buf.validate.field).string.pattern = "^[a-zA-Z\]//$"];
2042 /// }
2043 /// ```
2044 #[prost(string, optional, tag = "6")]
2045 pub pattern: ::core::option::Option<::prost::alloc::string::String>,
2046 /// `prefix` specifies that the field value must have the
2047 /// specified substring at the beginning of the string. If the field value
2048 /// doesn't start with the specified prefix, an error message will be
2049 /// generated.
2050 ///
2051 /// ```proto
2052 /// message MyString {
2053 /// // value does not have prefix `pre`
2054 /// string value = 1 \[(buf.validate.field).string.prefix = "pre"\];
2055 /// }
2056 /// ```
2057 #[prost(string, optional, tag = "7")]
2058 pub prefix: ::core::option::Option<::prost::alloc::string::String>,
2059 /// `suffix` specifies that the field value must have the
2060 /// specified substring at the end of the string. If the field value doesn't
2061 /// end with the specified suffix, an error message will be generated.
2062 ///
2063 /// ```proto
2064 /// message MyString {
2065 /// // value does not have suffix `post`
2066 /// string value = 1 \[(buf.validate.field).string.suffix = "post"\];
2067 /// }
2068 /// ```
2069 #[prost(string, optional, tag = "8")]
2070 pub suffix: ::core::option::Option<::prost::alloc::string::String>,
2071 /// `contains` specifies that the field value must have the
2072 /// specified substring anywhere in the string. If the field value doesn't
2073 /// contain the specified substring, an error message will be generated.
2074 ///
2075 /// ```proto
2076 /// message MyString {
2077 /// // value does not contain substring `inside`.
2078 /// string value = 1 \[(buf.validate.field).string.contains = "inside"\];
2079 /// }
2080 /// ```
2081 #[prost(string, optional, tag = "9")]
2082 pub contains: ::core::option::Option<::prost::alloc::string::String>,
2083 /// `not_contains` specifies that the field value must not have the
2084 /// specified substring anywhere in the string. If the field value contains
2085 /// the specified substring, an error message will be generated.
2086 ///
2087 /// ```proto
2088 /// message MyString {
2089 /// // value contains substring `inside`.
2090 /// string value = 1 \[(buf.validate.field).string.not_contains = "inside"\];
2091 /// }
2092 /// ```
2093 #[prost(string, optional, tag = "23")]
2094 pub not_contains: ::core::option::Option<::prost::alloc::string::String>,
2095 /// `in` specifies that the field value must be equal to one of the specified
2096 /// values. If the field value isn't one of the specified values, an error
2097 /// message will be generated.
2098 ///
2099 /// ```proto
2100 /// message MyString {
2101 /// // value must be in list \["apple", "banana"\]
2102 /// string value = 1 \[(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"\];
2103 /// }
2104 /// ```
2105 #[prost(string, repeated, tag = "10")]
2106 pub r#in: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2107 /// `not_in` specifies that the field value cannot be equal to any
2108 /// of the specified values. If the field value is one of the specified values,
2109 /// an error message will be generated.
2110 /// ```proto
2111 /// message MyString {
2112 /// // value must not be in list \["orange", "grape"\]
2113 /// string value = 1 \[(buf.validate.field).string.not_in = "orange", (buf.validate.field).string.not_in = "grape"\];
2114 /// }
2115 /// ```
2116 #[prost(string, repeated, tag = "11")]
2117 pub not_in: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2118 /// This applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to
2119 /// enable strict header validation. By default, this is true, and HTTP header
2120 /// validations are [RFC-compliant](<https://datatracker.ietf.org/doc/html/rfc7230#section-3>). Setting to false will enable looser
2121 /// validations that only disallow `\r\n\0` characters, which can be used to
2122 /// bypass header matching rules.
2123 ///
2124 /// ```proto
2125 /// message MyString {
2126 /// // The field `value` must have be a valid HTTP headers, but not enforced with strict rules.
2127 /// string value = 1 \[(buf.validate.field).string.strict = false\];
2128 /// }
2129 /// ```
2130 #[prost(bool, optional, tag = "25")]
2131 pub strict: ::core::option::Option<bool>,
2132 /// `example` specifies values that the field may have. These values SHOULD
2133 /// conform to other rules. `example` values will not impact validation
2134 /// but may be used as helpful guidance on how to populate the given field.
2135 ///
2136 /// ```proto
2137 /// message MyString {
2138 /// string value = 1 [
2139 /// (buf.validate.field).string.example = "hello",
2140 /// (buf.validate.field).string.example = "world"
2141 /// ];
2142 /// }
2143 /// ```
2144 #[prost(string, repeated, tag = "34")]
2145 pub example: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2146 /// `WellKnown` rules provide advanced rules against common string
2147 /// patterns.
2148 #[prost(
2149 oneof = "string_rules::WellKnown",
2150 tags = "12, 13, 14, 15, 16, 17, 18, 21, 22, 33, 26, 27, 28, 29, 30, 31, 32, 35, 24"
2151 )]
2152 pub well_known: ::core::option::Option<string_rules::WellKnown>,
2153}
2154/// Nested message and enum types in `StringRules`.
2155pub mod string_rules {
2156 /// `WellKnown` rules provide advanced rules against common string
2157 /// patterns.
2158 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
2159 pub enum WellKnown {
2160 /// `email` specifies that the field value must be a valid email address, for
2161 /// example "foo@example.com".
2162 ///
2163 /// Conforms to the definition for a valid email address from the [HTML standard](<https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address>).
2164 /// Note that this standard willfully deviates from [RFC 5322](<https://datatracker.ietf.org/doc/html/rfc5322>),
2165 /// which allows many unexpected forms of email addresses and will easily match
2166 /// a typographical error.
2167 ///
2168 /// If the field value isn't a valid email address, an error message will be generated.
2169 ///
2170 /// ```proto
2171 /// message MyString {
2172 /// // value must be a valid email address
2173 /// string value = 1 \[(buf.validate.field).string.email = true\];
2174 /// }
2175 /// ```
2176 #[prost(bool, tag = "12")]
2177 Email(bool),
2178 /// `hostname` specifies that the field value must be a valid hostname, for
2179 /// example "foo.example.com".
2180 ///
2181 /// A valid hostname follows the rules below:
2182 /// - The name consists of one or more labels, separated by a dot (".").
2183 /// - Each label can be 1 to 63 alphanumeric characters.
2184 /// - A label can contain hyphens ("-"), but must not start or end with a hyphen.
2185 /// - The right-most label must not be digits only.
2186 /// - The name can have a trailing dot—for example, "foo.example.com.".
2187 /// - The name can be 253 characters at most, excluding the optional trailing dot.
2188 ///
2189 /// If the field value isn't a valid hostname, an error message will be generated.
2190 ///
2191 /// ```proto
2192 /// message MyString {
2193 /// // value must be a valid hostname
2194 /// string value = 1 \[(buf.validate.field).string.hostname = true\];
2195 /// }
2196 /// ```
2197 #[prost(bool, tag = "13")]
2198 Hostname(bool),
2199 /// `ip` specifies that the field value must be a valid IP (v4 or v6) address.
2200 ///
2201 /// IPv4 addresses are expected in the dotted decimal format—for example, "192.168.5.21".
2202 /// IPv6 addresses are expected in their text representation—for example, "::1",
2203 /// or "2001:0DB8:ABCD:0012::0".
2204 ///
2205 /// Both formats are well-defined in the internet standard [RFC 3986](<https://datatracker.ietf.org/doc/html/rfc3986>).
2206 /// Zone identifiers for IPv6 addresses (for example, "fe80::a%en1") are supported.
2207 ///
2208 /// If the field value isn't a valid IP address, an error message will be
2209 /// generated.
2210 ///
2211 /// ```proto
2212 /// message MyString {
2213 /// // value must be a valid IP address
2214 /// string value = 1 \[(buf.validate.field).string.ip = true\];
2215 /// }
2216 /// ```
2217 #[prost(bool, tag = "14")]
2218 Ip(bool),
2219 /// `ipv4` specifies that the field value must be a valid IPv4 address—for
2220 /// example "192.168.5.21". If the field value isn't a valid IPv4 address, an
2221 /// error message will be generated.
2222 ///
2223 /// ```proto
2224 /// message MyString {
2225 /// // value must be a valid IPv4 address
2226 /// string value = 1 \[(buf.validate.field).string.ipv4 = true\];
2227 /// }
2228 /// ```
2229 #[prost(bool, tag = "15")]
2230 Ipv4(bool),
2231 /// `ipv6` specifies that the field value must be a valid IPv6 address—for
2232 /// example "::1", or "d7a:115c:a1e0:ab12:4843:cd96:626b:430b". If the field
2233 /// value is not a valid IPv6 address, an error message will be generated.
2234 ///
2235 /// ```proto
2236 /// message MyString {
2237 /// // value must be a valid IPv6 address
2238 /// string value = 1 \[(buf.validate.field).string.ipv6 = true\];
2239 /// }
2240 /// ```
2241 #[prost(bool, tag = "16")]
2242 Ipv6(bool),
2243 /// `uri` specifies that the field value must be a valid URI, for example
2244 /// "<https://example.com/foo/bar?baz=quux#frag".>
2245 ///
2246 /// URI is defined in the internet standard [RFC 3986](<https://datatracker.ietf.org/doc/html/rfc3986>).
2247 /// Zone Identifiers in IPv6 address literals are supported ([RFC 6874](<https://datatracker.ietf.org/doc/html/rfc6874>)).
2248 ///
2249 /// If the field value isn't a valid URI, an error message will be generated.
2250 ///
2251 /// ```proto
2252 /// message MyString {
2253 /// // value must be a valid URI
2254 /// string value = 1 \[(buf.validate.field).string.uri = true\];
2255 /// }
2256 /// ```
2257 #[prost(bool, tag = "17")]
2258 Uri(bool),
2259 /// `uri_ref` specifies that the field value must be a valid URI Reference—either
2260 /// a URI such as "<https://example.com/foo/bar?baz=quux#frag",> or a Relative
2261 /// Reference such as "./foo/bar?query".
2262 ///
2263 /// URI, URI Reference, and Relative Reference are defined in the internet
2264 /// standard [RFC 3986](<https://datatracker.ietf.org/doc/html/rfc3986>). Zone
2265 /// Identifiers in IPv6 address literals are supported ([RFC 6874](<https://datatracker.ietf.org/doc/html/rfc6874>)).
2266 ///
2267 /// If the field value isn't a valid URI Reference, an error message will be
2268 /// generated.
2269 ///
2270 /// ```proto
2271 /// message MyString {
2272 /// // value must be a valid URI Reference
2273 /// string value = 1 \[(buf.validate.field).string.uri_ref = true\];
2274 /// }
2275 /// ```
2276 #[prost(bool, tag = "18")]
2277 UriRef(bool),
2278 /// `address` specifies that the field value must be either a valid hostname
2279 /// (for example, "example.com"), or a valid IP (v4 or v6) address (for example,
2280 /// "192.168.0.1", or "::1"). If the field value isn't a valid hostname or IP,
2281 /// an error message will be generated.
2282 ///
2283 /// ```proto
2284 /// message MyString {
2285 /// // value must be a valid hostname, or ip address
2286 /// string value = 1 \[(buf.validate.field).string.address = true\];
2287 /// }
2288 /// ```
2289 #[prost(bool, tag = "21")]
2290 Address(bool),
2291 /// `uuid` specifies that the field value must be a valid UUID as defined by
2292 /// [RFC 4122](<https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2>). If the
2293 /// field value isn't a valid UUID, an error message will be generated.
2294 ///
2295 /// ```proto
2296 /// message MyString {
2297 /// // value must be a valid UUID
2298 /// string value = 1 \[(buf.validate.field).string.uuid = true\];
2299 /// }
2300 /// ```
2301 #[prost(bool, tag = "22")]
2302 Uuid(bool),
2303 /// `tuuid` (trimmed UUID) specifies that the field value must be a valid UUID as
2304 /// defined by [RFC 4122](<https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2>) with all dashes
2305 /// omitted. If the field value isn't a valid UUID without dashes, an error message
2306 /// will be generated.
2307 ///
2308 /// ```proto
2309 /// message MyString {
2310 /// // value must be a valid trimmed UUID
2311 /// string value = 1 \[(buf.validate.field).string.tuuid = true\];
2312 /// }
2313 /// ```
2314 #[prost(bool, tag = "33")]
2315 Tuuid(bool),
2316 /// `ip_with_prefixlen` specifies that the field value must be a valid IP
2317 /// (v4 or v6) address with prefix length—for example, "192.168.5.21/16" or
2318 /// "2001:0DB8:ABCD:0012::F1/64". If the field value isn't a valid IP with
2319 /// prefix length, an error message will be generated.
2320 ///
2321 /// ```proto
2322 /// message MyString {
2323 /// // value must be a valid IP with prefix length
2324 /// string value = 1 \[(buf.validate.field).string.ip_with_prefixlen = true\];
2325 /// }
2326 /// ```
2327 #[prost(bool, tag = "26")]
2328 IpWithPrefixlen(bool),
2329 /// `ipv4_with_prefixlen` specifies that the field value must be a valid
2330 /// IPv4 address with prefix length—for example, "192.168.5.21/16". If the
2331 /// field value isn't a valid IPv4 address with prefix length, an error
2332 /// message will be generated.
2333 ///
2334 /// ```proto
2335 /// message MyString {
2336 /// // value must be a valid IPv4 address with prefix length
2337 /// string value = 1 \[(buf.validate.field).string.ipv4_with_prefixlen = true\];
2338 /// }
2339 /// ```
2340 #[prost(bool, tag = "27")]
2341 Ipv4WithPrefixlen(bool),
2342 /// `ipv6_with_prefixlen` specifies that the field value must be a valid
2343 /// IPv6 address with prefix length—for example, "2001:0DB8:ABCD:0012::F1/64".
2344 /// If the field value is not a valid IPv6 address with prefix length,
2345 /// an error message will be generated.
2346 ///
2347 /// ```proto
2348 /// message MyString {
2349 /// // value must be a valid IPv6 address prefix length
2350 /// string value = 1 \[(buf.validate.field).string.ipv6_with_prefixlen = true\];
2351 /// }
2352 /// ```
2353 #[prost(bool, tag = "28")]
2354 Ipv6WithPrefixlen(bool),
2355 /// `ip_prefix` specifies that the field value must be a valid IP (v4 or v6)
2356 /// prefix—for example, "192.168.0.0/16" or "2001:0DB8:ABCD:0012::0/64".
2357 ///
2358 /// The prefix must have all zeros for the unmasked bits. For example,
2359 /// "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the
2360 /// prefix, and the remaining 64 bits must be zero.
2361 ///
2362 /// If the field value isn't a valid IP prefix, an error message will be
2363 /// generated.
2364 ///
2365 /// ```proto
2366 /// message MyString {
2367 /// // value must be a valid IP prefix
2368 /// string value = 1 \[(buf.validate.field).string.ip_prefix = true\];
2369 /// }
2370 /// ```
2371 #[prost(bool, tag = "29")]
2372 IpPrefix(bool),
2373 /// `ipv4_prefix` specifies that the field value must be a valid IPv4
2374 /// prefix, for example "192.168.0.0/16".
2375 ///
2376 /// The prefix must have all zeros for the unmasked bits. For example,
2377 /// "192.168.0.0/16" designates the left-most 16 bits for the prefix,
2378 /// and the remaining 16 bits must be zero.
2379 ///
2380 /// If the field value isn't a valid IPv4 prefix, an error message
2381 /// will be generated.
2382 ///
2383 /// ```proto
2384 /// message MyString {
2385 /// // value must be a valid IPv4 prefix
2386 /// string value = 1 \[(buf.validate.field).string.ipv4_prefix = true\];
2387 /// }
2388 /// ```
2389 #[prost(bool, tag = "30")]
2390 Ipv4Prefix(bool),
2391 /// `ipv6_prefix` specifies that the field value must be a valid IPv6 prefix—for
2392 /// example, "2001:0DB8:ABCD:0012::0/64".
2393 ///
2394 /// The prefix must have all zeros for the unmasked bits. For example,
2395 /// "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the
2396 /// prefix, and the remaining 64 bits must be zero.
2397 ///
2398 /// If the field value is not a valid IPv6 prefix, an error message will be
2399 /// generated.
2400 ///
2401 /// ```proto
2402 /// message MyString {
2403 /// // value must be a valid IPv6 prefix
2404 /// string value = 1 \[(buf.validate.field).string.ipv6_prefix = true\];
2405 /// }
2406 /// ```
2407 #[prost(bool, tag = "31")]
2408 Ipv6Prefix(bool),
2409 /// `host_and_port` specifies that the field value must be valid host/port
2410 /// pair—for example, "example.com:8080".
2411 ///
2412 /// The host can be one of:
2413 /// - An IPv4 address in dotted decimal format—for example, "192.168.5.21".
2414 /// - An IPv6 address enclosed in square brackets—for example, "\[2001:0DB8:ABCD:0012::F1\]".
2415 /// - A hostname—for example, "example.com".
2416 ///
2417 /// The port is separated by a colon. It must be non-empty, with a decimal number
2418 /// in the range of 0-65535, inclusive.
2419 #[prost(bool, tag = "32")]
2420 HostAndPort(bool),
2421 /// `ulid` specifies that the field value must be a valid ULID (Universally Unique
2422 /// Lexicographically Sortable Identifier) as defined by the [ULID specification](<https://github.com/ulid/spec>).
2423 /// If the field value isn't a valid ULID, an error message will be generated.
2424 ///
2425 /// ```proto
2426 /// message MyString {
2427 /// // value must be a valid ULID
2428 /// string value = 1 \[(buf.validate.field).string.ulid = true\];
2429 /// }
2430 /// ```
2431 #[prost(bool, tag = "35")]
2432 Ulid(bool),
2433 /// `well_known_regex` specifies a common well-known pattern
2434 /// defined as a regex. If the field value doesn't match the well-known
2435 /// regex, an error message will be generated.
2436 ///
2437 /// ```proto
2438 /// message MyString {
2439 /// // value must be a valid HTTP header value
2440 /// string value = 1 \[(buf.validate.field).string.well_known_regex = KNOWN_REGEX_HTTP_HEADER_VALUE\];
2441 /// }
2442 /// ```
2443 ///
2444 /// #### KnownRegex
2445 ///
2446 /// `well_known_regex` contains some well-known patterns.
2447 ///
2448 /// | Name | Number | Description |
2449 /// |-------------------------------|--------|-------------------------------------------|
2450 /// | KNOWN_REGEX_UNSPECIFIED | 0 | |
2451 /// | KNOWN_REGEX_HTTP_HEADER_NAME | 1 | HTTP header name as defined by [RFC 7230](<https://datatracker.ietf.org/doc/html/rfc7230#section-3.2>) |
2452 /// | KNOWN_REGEX_HTTP_HEADER_VALUE | 2 | HTTP header value as defined by [RFC 7230](<https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4>) |
2453 #[prost(enumeration = "super::KnownRegex", tag = "24")]
2454 WellKnownRegex(i32),
2455 }
2456}
2457/// BytesRules describe the rules applied to `bytes` values. These rules
2458/// may also be applied to the `google.protobuf.BytesValue` Well-Known-Type.
2459#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2460pub struct BytesRules {
2461 /// `const` requires the field value to exactly match the specified bytes
2462 /// value. If the field value doesn't match, an error message is generated.
2463 ///
2464 /// ```proto
2465 /// message MyBytes {
2466 /// // value must be "\x01\x02\x03\x04"
2467 /// bytes value = 1 \[(buf.validate.field).bytes.const = "\x01\x02\x03\x04"\];
2468 /// }
2469 /// ```
2470 #[prost(bytes = "bytes", optional, tag = "1")]
2471 pub r#const: ::core::option::Option<::prost::bytes::Bytes>,
2472 /// `len` requires the field value to have the specified length in bytes.
2473 /// If the field value doesn't match, an error message is generated.
2474 ///
2475 /// ```proto
2476 /// message MyBytes {
2477 /// // value length must be 4 bytes.
2478 /// optional bytes value = 1 \[(buf.validate.field).bytes.len = 4\];
2479 /// }
2480 /// ```
2481 #[prost(uint64, optional, tag = "13")]
2482 pub len: ::core::option::Option<u64>,
2483 /// `min_len` requires the field value to have at least the specified minimum
2484 /// length in bytes.
2485 /// If the field value doesn't meet the requirement, an error message is generated.
2486 ///
2487 /// ```proto
2488 /// message MyBytes {
2489 /// // value length must be at least 2 bytes.
2490 /// optional bytes value = 1 \[(buf.validate.field).bytes.min_len = 2\];
2491 /// }
2492 /// ```
2493 #[prost(uint64, optional, tag = "2")]
2494 pub min_len: ::core::option::Option<u64>,
2495 /// `max_len` requires the field value to have at most the specified maximum
2496 /// length in bytes.
2497 /// If the field value exceeds the requirement, an error message is generated.
2498 ///
2499 /// ```proto
2500 /// message MyBytes {
2501 /// // value must be at most 6 bytes.
2502 /// optional bytes value = 1 \[(buf.validate.field).bytes.max_len = 6\];
2503 /// }
2504 /// ```
2505 #[prost(uint64, optional, tag = "3")]
2506 pub max_len: ::core::option::Option<u64>,
2507 /// `pattern` requires the field value to match the specified regular
2508 /// expression ([RE2 syntax](<https://github.com/google/re2/wiki/Syntax>)).
2509 /// The value of the field must be valid UTF-8 or validation will fail with a
2510 /// runtime error.
2511 /// If the field value doesn't match the pattern, an error message is generated.
2512 ///
2513 /// ```proto
2514 /// message MyBytes {
2515 /// // value must match regex pattern "^\[a-zA-Z0-9\]+$".
2516 /// optional bytes value = 1 \[(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9\]+$"];
2517 /// }
2518 /// ```
2519 #[prost(string, optional, tag = "4")]
2520 pub pattern: ::core::option::Option<::prost::alloc::string::String>,
2521 /// `prefix` requires the field value to have the specified bytes at the
2522 /// beginning of the string.
2523 /// If the field value doesn't meet the requirement, an error message is generated.
2524 ///
2525 /// ```proto
2526 /// message MyBytes {
2527 /// // value does not have prefix \x01\x02
2528 /// optional bytes value = 1 \[(buf.validate.field).bytes.prefix = "\x01\x02"\];
2529 /// }
2530 /// ```
2531 #[prost(bytes = "bytes", optional, tag = "5")]
2532 pub prefix: ::core::option::Option<::prost::bytes::Bytes>,
2533 /// `suffix` requires the field value to have the specified bytes at the end
2534 /// of the string.
2535 /// If the field value doesn't meet the requirement, an error message is generated.
2536 ///
2537 /// ```proto
2538 /// message MyBytes {
2539 /// // value does not have suffix \x03\x04
2540 /// optional bytes value = 1 \[(buf.validate.field).bytes.suffix = "\x03\x04"\];
2541 /// }
2542 /// ```
2543 #[prost(bytes = "bytes", optional, tag = "6")]
2544 pub suffix: ::core::option::Option<::prost::bytes::Bytes>,
2545 /// `contains` requires the field value to have the specified bytes anywhere in
2546 /// the string.
2547 /// If the field value doesn't meet the requirement, an error message is generated.
2548 ///
2549 /// ```proto
2550 /// message MyBytes {
2551 /// // value does not contain \x02\x03
2552 /// optional bytes value = 1 \[(buf.validate.field).bytes.contains = "\x02\x03"\];
2553 /// }
2554 /// ```
2555 #[prost(bytes = "bytes", optional, tag = "7")]
2556 pub contains: ::core::option::Option<::prost::bytes::Bytes>,
2557 /// `in` requires the field value to be equal to one of the specified
2558 /// values. If the field value doesn't match any of the specified values, an
2559 /// error message is generated.
2560 ///
2561 /// ```proto
2562 /// message MyBytes {
2563 /// // value must in \["\x01\x02", "\x02\x03", "\x03\x04"\]
2564 /// optional bytes value = 1 \[(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}\];
2565 /// }
2566 /// ```
2567 #[prost(bytes = "bytes", repeated, tag = "8")]
2568 pub r#in: ::prost::alloc::vec::Vec<::prost::bytes::Bytes>,
2569 /// `not_in` requires the field value to be not equal to any of the specified
2570 /// values.
2571 /// If the field value matches any of the specified values, an error message is
2572 /// generated.
2573 ///
2574 /// ```proto
2575 /// message MyBytes {
2576 /// // value must not in \["\x01\x02", "\x02\x03", "\x03\x04"\]
2577 /// optional bytes value = 1 \[(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}\];
2578 /// }
2579 /// ```
2580 #[prost(bytes = "bytes", repeated, tag = "9")]
2581 pub not_in: ::prost::alloc::vec::Vec<::prost::bytes::Bytes>,
2582 /// `example` specifies values that the field may have. These values SHOULD
2583 /// conform to other rules. `example` values will not impact validation
2584 /// but may be used as helpful guidance on how to populate the given field.
2585 ///
2586 /// ```proto
2587 /// message MyBytes {
2588 /// bytes value = 1 [
2589 /// (buf.validate.field).bytes.example = "\x01\x02",
2590 /// (buf.validate.field).bytes.example = "\x02\x03"
2591 /// ];
2592 /// }
2593 /// ```
2594 #[prost(bytes = "bytes", repeated, tag = "14")]
2595 pub example: ::prost::alloc::vec::Vec<::prost::bytes::Bytes>,
2596 /// WellKnown rules provide advanced rules against common byte
2597 /// patterns
2598 #[prost(oneof = "bytes_rules::WellKnown", tags = "10, 11, 12, 15")]
2599 pub well_known: ::core::option::Option<bytes_rules::WellKnown>,
2600}
2601/// Nested message and enum types in `BytesRules`.
2602pub mod bytes_rules {
2603 /// WellKnown rules provide advanced rules against common byte
2604 /// patterns
2605 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
2606 pub enum WellKnown {
2607 /// `ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format.
2608 /// If the field value doesn't meet this rule, an error message is generated.
2609 ///
2610 /// ```proto
2611 /// message MyBytes {
2612 /// // value must be a valid IP address
2613 /// optional bytes value = 1 \[(buf.validate.field).bytes.ip = true\];
2614 /// }
2615 /// ```
2616 #[prost(bool, tag = "10")]
2617 Ip(bool),
2618 /// `ipv4` ensures that the field `value` is a valid IPv4 address in byte format.
2619 /// If the field value doesn't meet this rule, an error message is generated.
2620 ///
2621 /// ```proto
2622 /// message MyBytes {
2623 /// // value must be a valid IPv4 address
2624 /// optional bytes value = 1 \[(buf.validate.field).bytes.ipv4 = true\];
2625 /// }
2626 /// ```
2627 #[prost(bool, tag = "11")]
2628 Ipv4(bool),
2629 /// `ipv6` ensures that the field `value` is a valid IPv6 address in byte format.
2630 /// If the field value doesn't meet this rule, an error message is generated.
2631 /// ```proto
2632 /// message MyBytes {
2633 /// // value must be a valid IPv6 address
2634 /// optional bytes value = 1 \[(buf.validate.field).bytes.ipv6 = true\];
2635 /// }
2636 /// ```
2637 #[prost(bool, tag = "12")]
2638 Ipv6(bool),
2639 /// `uuid` ensures that the field `value` encodes the 128-bit UUID data as
2640 /// defined by [RFC 4122](<https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2>).
2641 /// The field must contain exactly 16 bytes
2642 /// representing the UUID. If the field value isn't a valid UUID, an error
2643 /// message will be generated.
2644 ///
2645 /// ```proto
2646 /// message MyBytes {
2647 /// // value must be a valid UUID
2648 /// optional bytes value = 1 \[(buf.validate.field).bytes.uuid = true\];
2649 /// }
2650 /// ```
2651 #[prost(bool, tag = "15")]
2652 Uuid(bool),
2653 }
2654}
2655/// EnumRules describe the rules applied to `enum` values.
2656#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2657pub struct EnumRules {
2658 /// `const` requires the field value to exactly match the specified enum value.
2659 /// If the field value doesn't match, an error message is generated.
2660 ///
2661 /// ```proto
2662 /// enum MyEnum {
2663 /// MY_ENUM_UNSPECIFIED = 0;
2664 /// MY_ENUM_VALUE1 = 1;
2665 /// MY_ENUM_VALUE2 = 2;
2666 /// }
2667 ///
2668 /// message MyMessage {
2669 /// // The field `value` must be exactly MY_ENUM_VALUE1.
2670 /// MyEnum value = 1 \[(buf.validate.field).enum.const = 1\];
2671 /// }
2672 /// ```
2673 #[prost(int32, optional, tag = "1")]
2674 pub r#const: ::core::option::Option<i32>,
2675 /// `defined_only` requires the field value to be one of the defined values for
2676 /// this enum, failing on any undefined value.
2677 ///
2678 /// ```proto
2679 /// enum MyEnum {
2680 /// MY_ENUM_UNSPECIFIED = 0;
2681 /// MY_ENUM_VALUE1 = 1;
2682 /// MY_ENUM_VALUE2 = 2;
2683 /// }
2684 ///
2685 /// message MyMessage {
2686 /// // The field `value` must be a defined value of MyEnum.
2687 /// MyEnum value = 1 \[(buf.validate.field).enum.defined_only = true\];
2688 /// }
2689 /// ```
2690 #[prost(bool, optional, tag = "2")]
2691 pub defined_only: ::core::option::Option<bool>,
2692 /// `in` requires the field value to be equal to one of the
2693 /// specified enum values. If the field value doesn't match any of the
2694 /// specified values, an error message is generated.
2695 ///
2696 /// ```proto
2697 /// enum MyEnum {
2698 /// MY_ENUM_UNSPECIFIED = 0;
2699 /// MY_ENUM_VALUE1 = 1;
2700 /// MY_ENUM_VALUE2 = 2;
2701 /// }
2702 ///
2703 /// message MyMessage {
2704 /// // The field `value` must be equal to one of the specified values.
2705 /// MyEnum value = 1 \[(buf.validate.field).enum = { in: [1, 2\]}];
2706 /// }
2707 /// ```
2708 #[prost(int32, repeated, packed = "false", tag = "3")]
2709 pub r#in: ::prost::alloc::vec::Vec<i32>,
2710 /// `not_in` requires the field value to be not equal to any of the
2711 /// specified enum values. If the field value matches one of the specified
2712 /// values, an error message is generated.
2713 ///
2714 /// ```proto
2715 /// enum MyEnum {
2716 /// MY_ENUM_UNSPECIFIED = 0;
2717 /// MY_ENUM_VALUE1 = 1;
2718 /// MY_ENUM_VALUE2 = 2;
2719 /// }
2720 ///
2721 /// message MyMessage {
2722 /// // The field `value` must not be equal to any of the specified values.
2723 /// MyEnum value = 1 \[(buf.validate.field).enum = { not_in: [1, 2\]}];
2724 /// }
2725 /// ```
2726 #[prost(int32, repeated, packed = "false", tag = "4")]
2727 pub not_in: ::prost::alloc::vec::Vec<i32>,
2728 /// `example` specifies values that the field may have. These values SHOULD
2729 /// conform to other rules. `example` values will not impact validation
2730 /// but may be used as helpful guidance on how to populate the given field.
2731 ///
2732 /// ```proto
2733 /// enum MyEnum {
2734 /// MY_ENUM_UNSPECIFIED = 0;
2735 /// MY_ENUM_VALUE1 = 1;
2736 /// MY_ENUM_VALUE2 = 2;
2737 /// }
2738 ///
2739 /// message MyMessage {
2740 /// (buf.validate.field).enum.example = 1,
2741 /// (buf.validate.field).enum.example = 2
2742 /// }
2743 /// ```
2744 #[prost(int32, repeated, packed = "false", tag = "5")]
2745 pub example: ::prost::alloc::vec::Vec<i32>,
2746}
2747/// RepeatedRules describe the rules applied to `repeated` values.
2748#[derive(Clone, PartialEq, ::prost::Message)]
2749pub struct RepeatedRules {
2750 /// `min_items` requires that this field must contain at least the specified
2751 /// minimum number of items.
2752 ///
2753 /// Note that `min_items = 1` is equivalent to setting a field as `required`.
2754 ///
2755 /// ```proto
2756 /// message MyRepeated {
2757 /// // value must contain at least 2 items
2758 /// repeated string value = 1 \[(buf.validate.field).repeated.min_items = 2\];
2759 /// }
2760 /// ```
2761 #[prost(uint64, optional, tag = "1")]
2762 pub min_items: ::core::option::Option<u64>,
2763 /// `max_items` denotes that this field must not exceed a
2764 /// certain number of items as the upper limit. If the field contains more
2765 /// items than specified, an error message will be generated, requiring the
2766 /// field to maintain no more than the specified number of items.
2767 ///
2768 /// ```proto
2769 /// message MyRepeated {
2770 /// // value must contain no more than 3 item(s)
2771 /// repeated string value = 1 \[(buf.validate.field).repeated.max_items = 3\];
2772 /// }
2773 /// ```
2774 #[prost(uint64, optional, tag = "2")]
2775 pub max_items: ::core::option::Option<u64>,
2776 /// `unique` indicates that all elements in this field must
2777 /// be unique. This rule is strictly applicable to scalar and enum
2778 /// types, with message types not being supported.
2779 ///
2780 /// ```proto
2781 /// message MyRepeated {
2782 /// // repeated value must contain unique items
2783 /// repeated string value = 1 \[(buf.validate.field).repeated.unique = true\];
2784 /// }
2785 /// ```
2786 #[prost(bool, optional, tag = "3")]
2787 pub unique: ::core::option::Option<bool>,
2788 /// `items` details the rules to be applied to each item
2789 /// in the field. Even for repeated message fields, validation is executed
2790 /// against each item unless `ignore` is specified.
2791 ///
2792 /// ```proto
2793 /// message MyRepeated {
2794 /// // The items in the field `value` must follow the specified rules.
2795 /// repeated string value = 1 [(buf.validate.field).repeated.items = {
2796 /// string: {
2797 /// min_len: 3
2798 /// max_len: 10
2799 /// }
2800 /// }];
2801 /// }
2802 /// ```
2803 ///
2804 /// Note that the `required` rule does not apply. Repeated items
2805 /// cannot be unset.
2806 #[prost(message, optional, boxed, tag = "4")]
2807 pub items: ::core::option::Option<::prost::alloc::boxed::Box<FieldRules>>,
2808}
2809/// MapRules describe the rules applied to `map` values.
2810#[derive(Clone, PartialEq, ::prost::Message)]
2811pub struct MapRules {
2812 /// Specifies the minimum number of key-value pairs allowed. If the field has
2813 /// fewer key-value pairs than specified, an error message is generated.
2814 ///
2815 /// ```proto
2816 /// message MyMap {
2817 /// // The field `value` must have at least 2 key-value pairs.
2818 /// map<string, string> value = 1 \[(buf.validate.field).map.min_pairs = 2\];
2819 /// }
2820 /// ```
2821 #[prost(uint64, optional, tag = "1")]
2822 pub min_pairs: ::core::option::Option<u64>,
2823 /// Specifies the maximum number of key-value pairs allowed. If the field has
2824 /// more key-value pairs than specified, an error message is generated.
2825 ///
2826 /// ```proto
2827 /// message MyMap {
2828 /// // The field `value` must have at most 3 key-value pairs.
2829 /// map<string, string> value = 1 \[(buf.validate.field).map.max_pairs = 3\];
2830 /// }
2831 /// ```
2832 #[prost(uint64, optional, tag = "2")]
2833 pub max_pairs: ::core::option::Option<u64>,
2834 /// Specifies the rules to be applied to each key in the field.
2835 ///
2836 /// ```proto
2837 /// message MyMap {
2838 /// // The keys in the field `value` must follow the specified rules.
2839 /// map<string, string> value = 1 [(buf.validate.field).map.keys = {
2840 /// string: {
2841 /// min_len: 3
2842 /// max_len: 10
2843 /// }
2844 /// }];
2845 /// }
2846 /// ```
2847 ///
2848 /// Note that the `required` rule does not apply. Map keys cannot be unset.
2849 #[prost(message, optional, boxed, tag = "4")]
2850 pub keys: ::core::option::Option<::prost::alloc::boxed::Box<FieldRules>>,
2851 /// Specifies the rules to be applied to the value of each key in the
2852 /// field. Message values will still have their validations evaluated unless
2853 /// `ignore` is specified.
2854 ///
2855 /// ```proto
2856 /// message MyMap {
2857 /// // The values in the field `value` must follow the specified rules.
2858 /// map<string, string> value = 1 [(buf.validate.field).map.values = {
2859 /// string: {
2860 /// min_len: 5
2861 /// max_len: 20
2862 /// }
2863 /// }];
2864 /// }
2865 /// ```
2866 /// Note that the `required` rule does not apply. Map values cannot be unset.
2867 #[prost(message, optional, boxed, tag = "5")]
2868 pub values: ::core::option::Option<::prost::alloc::boxed::Box<FieldRules>>,
2869}
2870/// AnyRules describe rules applied exclusively to the `google.protobuf.Any` well-known type.
2871#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2872pub struct AnyRules {
2873 /// `in` requires the field's `type_url` to be equal to one of the
2874 /// specified values. If it doesn't match any of the specified values, an error
2875 /// message is generated.
2876 ///
2877 /// ```proto
2878 /// message MyAny {
2879 /// // The `value` field must have a `type_url` equal to one of the specified values.
2880 /// google.protobuf.Any value = 1 [(buf.validate.field).any = {
2881 /// in: \["type.googleapis.com/MyType1", "type.googleapis.com/MyType2"\]
2882 /// }];
2883 /// }
2884 /// ```
2885 #[prost(string, repeated, tag = "2")]
2886 pub r#in: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2887 /// requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated.
2888 ///
2889 /// ```proto
2890 /// message MyAny {
2891 /// // The `value` field must not have a `type_url` equal to any of the specified values.
2892 /// google.protobuf.Any value = 1 [(buf.validate.field).any = {
2893 /// not_in: \["type.googleapis.com/ForbiddenType1", "type.googleapis.com/ForbiddenType2"\]
2894 /// }];
2895 /// }
2896 /// ```
2897 #[prost(string, repeated, tag = "3")]
2898 pub not_in: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2899}
2900/// DurationRules describe the rules applied exclusively to the `google.protobuf.Duration` well-known type.
2901#[derive(Clone, PartialEq, Eq, ::prost::Message)]
2902pub struct DurationRules {
2903 /// `const` dictates that the field must match the specified value of the `google.protobuf.Duration` type exactly.
2904 /// If the field's value deviates from the specified value, an error message
2905 /// will be generated.
2906 ///
2907 /// ```proto
2908 /// message MyDuration {
2909 /// // value must equal 5s
2910 /// google.protobuf.Duration value = 1 \[(buf.validate.field).duration.const = "5s"\];
2911 /// }
2912 /// ```
2913 #[prost(message, optional, tag = "2")]
2914 pub r#const: ::core::option::Option<crate::protobuf::Duration>,
2915 /// `in` asserts that the field must be equal to one of the specified values of the `google.protobuf.Duration` type.
2916 /// If the field's value doesn't correspond to any of the specified values,
2917 /// an error message will be generated.
2918 ///
2919 /// ```proto
2920 /// message MyDuration {
2921 /// // value must be in list \[1s, 2s, 3s\]
2922 /// google.protobuf.Duration value = 1 \[(buf.validate.field).duration.in = ["1s", "2s", "3s"]\];
2923 /// }
2924 /// ```
2925 #[prost(message, repeated, tag = "7")]
2926 pub r#in: ::prost::alloc::vec::Vec<crate::protobuf::Duration>,
2927 /// `not_in` denotes that the field must not be equal to
2928 /// any of the specified values of the `google.protobuf.Duration` type.
2929 /// If the field's value matches any of these values, an error message will be
2930 /// generated.
2931 ///
2932 /// ```proto
2933 /// message MyDuration {
2934 /// // value must not be in list \[1s, 2s, 3s\]
2935 /// google.protobuf.Duration value = 1 \[(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]\];
2936 /// }
2937 /// ```
2938 #[prost(message, repeated, tag = "8")]
2939 pub not_in: ::prost::alloc::vec::Vec<crate::protobuf::Duration>,
2940 /// `example` specifies values that the field may have. These values SHOULD
2941 /// conform to other rules. `example` values will not impact validation
2942 /// but may be used as helpful guidance on how to populate the given field.
2943 ///
2944 /// ```proto
2945 /// message MyDuration {
2946 /// google.protobuf.Duration value = 1 [
2947 /// (buf.validate.field).duration.example = { seconds: 1 },
2948 /// (buf.validate.field).duration.example = { seconds: 2 },
2949 /// ];
2950 /// }
2951 /// ```
2952 #[prost(message, repeated, tag = "9")]
2953 pub example: ::prost::alloc::vec::Vec<crate::protobuf::Duration>,
2954 #[prost(oneof = "duration_rules::LessThan", tags = "3, 4")]
2955 pub less_than: ::core::option::Option<duration_rules::LessThan>,
2956 #[prost(oneof = "duration_rules::GreaterThan", tags = "5, 6")]
2957 pub greater_than: ::core::option::Option<duration_rules::GreaterThan>,
2958}
2959/// Nested message and enum types in `DurationRules`.
2960pub mod duration_rules {
2961 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
2962 pub enum LessThan {
2963 /// `lt` stipulates that the field must be less than the specified value of the `google.protobuf.Duration` type,
2964 /// exclusive. If the field's value is greater than or equal to the specified
2965 /// value, an error message will be generated.
2966 ///
2967 /// ```proto
2968 /// message MyDuration {
2969 /// // value must be less than 5s
2970 /// google.protobuf.Duration value = 1 \[(buf.validate.field).duration.lt = "5s"\];
2971 /// }
2972 /// ```
2973 #[prost(message, tag = "3")]
2974 Lt(crate::protobuf::Duration),
2975 /// `lte` indicates that the field must be less than or equal to the specified
2976 /// value of the `google.protobuf.Duration` type, inclusive. If the field's value is greater than the specified value,
2977 /// an error message will be generated.
2978 ///
2979 /// ```proto
2980 /// message MyDuration {
2981 /// // value must be less than or equal to 10s
2982 /// google.protobuf.Duration value = 1 \[(buf.validate.field).duration.lte = "10s"\];
2983 /// }
2984 /// ```
2985 #[prost(message, tag = "4")]
2986 Lte(crate::protobuf::Duration),
2987 }
2988 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
2989 pub enum GreaterThan {
2990 /// `gt` requires the duration field value to be greater than the specified
2991 /// value (exclusive). If the value of `gt` is larger than a specified `lt`
2992 /// or `lte`, the range is reversed, and the field value must be outside the
2993 /// specified range. If the field value doesn't meet the required conditions,
2994 /// an error message is generated.
2995 ///
2996 /// ```proto
2997 /// message MyDuration {
2998 /// // duration must be greater than 5s \[duration.gt\]
2999 /// google.protobuf.Duration value = 1 \[(buf.validate.field).duration.gt = { seconds: 5 }\];
3000 ///
3001 /// // duration must be greater than 5s and less than 10s \[duration.gt_lt\]
3002 /// google.protobuf.Duration another_value = 2 \[(buf.validate.field).duration = { gt: { seconds: 5 }, lt: { seconds: 10 } }\];
3003 ///
3004 /// // duration must be greater than 10s or less than 5s \[duration.gt_lt_exclusive\]
3005 /// google.protobuf.Duration other_value = 3 \[(buf.validate.field).duration = { gt: { seconds: 10 }, lt: { seconds: 5 } }\];
3006 /// }
3007 /// ```
3008 #[prost(message, tag = "5")]
3009 Gt(crate::protobuf::Duration),
3010 /// `gte` requires the duration field value to be greater than or equal to the
3011 /// specified value (exclusive). If the value of `gte` is larger than a
3012 /// specified `lt` or `lte`, the range is reversed, and the field value must
3013 /// be outside the specified range. If the field value doesn't meet the
3014 /// required conditions, an error message is generated.
3015 ///
3016 /// ```proto
3017 /// message MyDuration {
3018 /// // duration must be greater than or equal to 5s \[duration.gte\]
3019 /// google.protobuf.Duration value = 1 \[(buf.validate.field).duration.gte = { seconds: 5 }\];
3020 ///
3021 /// // duration must be greater than or equal to 5s and less than 10s \[duration.gte_lt\]
3022 /// google.protobuf.Duration another_value = 2 \[(buf.validate.field).duration = { gte: { seconds: 5 }, lt: { seconds: 10 } }\];
3023 ///
3024 /// // duration must be greater than or equal to 10s or less than 5s \[duration.gte_lt_exclusive\]
3025 /// google.protobuf.Duration other_value = 3 \[(buf.validate.field).duration = { gte: { seconds: 10 }, lt: { seconds: 5 } }\];
3026 /// }
3027 /// ```
3028 #[prost(message, tag = "6")]
3029 Gte(crate::protobuf::Duration),
3030 }
3031}
3032/// FieldMaskRules describe rules applied exclusively to the `google.protobuf.FieldMask` well-known type.
3033#[derive(Clone, PartialEq, Eq, ::prost::Message)]
3034pub struct FieldMaskRules {
3035 /// `const` dictates that the field must match the specified value of the `google.protobuf.FieldMask` type exactly.
3036 /// If the field's value deviates from the specified value, an error message
3037 /// will be generated.
3038 ///
3039 /// ```proto
3040 /// message MyFieldMask {
3041 /// // value must equal \["a"\]
3042 /// google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask.const = {
3043 /// paths: \["a"\]
3044 /// }];
3045 /// }
3046 /// ```
3047 #[prost(message, optional, tag = "1")]
3048 pub r#const: ::core::option::Option<crate::protobuf::FieldMask>,
3049 /// `in` requires the field value to only contain paths matching specified
3050 /// values or their subpaths.
3051 /// If any of the field value's paths doesn't match the rule,
3052 /// an error message is generated.
3053 /// See: <https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask>
3054 ///
3055 /// ```proto
3056 /// message MyFieldMask {
3057 /// // The `value` FieldMask must only contain paths listed in `in`.
3058 /// google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = {
3059 /// in: \["a", "b", "c.a"\]
3060 /// }];
3061 /// }
3062 /// ```
3063 #[prost(string, repeated, tag = "2")]
3064 pub r#in: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3065 /// `not_in` requires the field value to not contain paths matching specified
3066 /// values or their subpaths.
3067 /// If any of the field value's paths matches the rule,
3068 /// an error message is generated.
3069 /// See: <https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask>
3070 ///
3071 /// ```proto
3072 /// message MyFieldMask {
3073 /// // The `value` FieldMask shall not contain paths listed in `not_in`.
3074 /// google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = {
3075 /// not_in: \["forbidden", "immutable", "c.a"\]
3076 /// }];
3077 /// }
3078 /// ```
3079 #[prost(string, repeated, tag = "3")]
3080 pub not_in: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3081 /// `example` specifies values that the field may have. These values SHOULD
3082 /// conform to other rules. `example` values will not impact validation
3083 /// but may be used as helpful guidance on how to populate the given field.
3084 ///
3085 /// ```proto
3086 /// message MyFieldMask {
3087 /// google.protobuf.FieldMask value = 1 [
3088 /// (buf.validate.field).field_mask.example = { paths: \["a", "b"\] },
3089 /// (buf.validate.field).field_mask.example = { paths: \["c.a", "d"\] },
3090 /// ];
3091 /// }
3092 /// ```
3093 #[prost(message, repeated, tag = "4")]
3094 pub example: ::prost::alloc::vec::Vec<crate::protobuf::FieldMask>,
3095}
3096/// TimestampRules describe the rules applied exclusively to the `google.protobuf.Timestamp` well-known type.
3097#[derive(Clone, PartialEq, Eq, ::prost::Message)]
3098pub struct TimestampRules {
3099 /// `const` dictates that this field, of the `google.protobuf.Timestamp` type, must exactly match the specified value. If the field value doesn't correspond to the specified timestamp, an error message will be generated.
3100 ///
3101 /// ```proto
3102 /// message MyTimestamp {
3103 /// // value must equal 2023-05-03T10:00:00Z
3104 /// google.protobuf.Timestamp created_at = 1 \[(buf.validate.field).timestamp.const = {seconds: 1727998800}\];
3105 /// }
3106 /// ```
3107 #[prost(message, optional, tag = "2")]
3108 pub r#const: ::core::option::Option<crate::protobuf::Timestamp>,
3109 /// `within` specifies that this field, of the `google.protobuf.Timestamp` type, must be within the specified duration of the current time. If the field value isn't within the duration, an error message is generated.
3110 ///
3111 /// ```proto
3112 /// message MyTimestamp {
3113 /// // value must be within 1 hour of now
3114 /// google.protobuf.Timestamp created_at = 1 \[(buf.validate.field).timestamp.within = {seconds: 3600}\];
3115 /// }
3116 /// ```
3117 #[prost(message, optional, tag = "9")]
3118 pub within: ::core::option::Option<crate::protobuf::Duration>,
3119 /// `example` specifies values that the field may have. These values SHOULD
3120 /// conform to other rules. `example` values will not impact validation
3121 /// but may be used as helpful guidance on how to populate the given field.
3122 ///
3123 /// ```proto
3124 /// message MyTimestamp {
3125 /// google.protobuf.Timestamp value = 1 [
3126 /// (buf.validate.field).timestamp.example = { seconds: 1672444800 },
3127 /// (buf.validate.field).timestamp.example = { seconds: 1672531200 },
3128 /// ];
3129 /// }
3130 /// ```
3131 #[prost(message, repeated, tag = "10")]
3132 pub example: ::prost::alloc::vec::Vec<crate::protobuf::Timestamp>,
3133 #[prost(oneof = "timestamp_rules::LessThan", tags = "3, 4, 7")]
3134 pub less_than: ::core::option::Option<timestamp_rules::LessThan>,
3135 #[prost(oneof = "timestamp_rules::GreaterThan", tags = "5, 6, 8")]
3136 pub greater_than: ::core::option::Option<timestamp_rules::GreaterThan>,
3137}
3138/// Nested message and enum types in `TimestampRules`.
3139pub mod timestamp_rules {
3140 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
3141 pub enum LessThan {
3142 /// requires the duration field value to be less than the specified value (field < value). If the field value doesn't meet the required conditions, an error message is generated.
3143 ///
3144 /// ```proto
3145 /// message MyDuration {
3146 /// // duration must be less than 'P3D' \[duration.lt\]
3147 /// google.protobuf.Duration value = 1 \[(buf.validate.field).duration.lt = { seconds: 259200 }\];
3148 /// }
3149 /// ```
3150 #[prost(message, tag = "3")]
3151 Lt(crate::protobuf::Timestamp),
3152 /// requires the timestamp field value to be less than or equal to the specified value (field <= value). If the field value doesn't meet the required conditions, an error message is generated.
3153 ///
3154 /// ```proto
3155 /// message MyTimestamp {
3156 /// // timestamp must be less than or equal to '2023-05-14T00:00:00Z' \[timestamp.lte\]
3157 /// google.protobuf.Timestamp value = 1 \[(buf.validate.field).timestamp.lte = { seconds: 1678867200 }\];
3158 /// }
3159 /// ```
3160 #[prost(message, tag = "4")]
3161 Lte(crate::protobuf::Timestamp),
3162 /// `lt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be less than the current time. `lt_now` can only be used with the `within` rule.
3163 ///
3164 /// ```proto
3165 /// message MyTimestamp {
3166 /// // value must be less than now
3167 /// google.protobuf.Timestamp created_at = 1 \[(buf.validate.field).timestamp.lt_now = true\];
3168 /// }
3169 /// ```
3170 #[prost(bool, tag = "7")]
3171 LtNow(bool),
3172 }
3173 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
3174 pub enum GreaterThan {
3175 /// `gt` requires the timestamp field value to be greater than the specified
3176 /// value (exclusive). If the value of `gt` is larger than a specified `lt`
3177 /// or `lte`, the range is reversed, and the field value must be outside the
3178 /// specified range. If the field value doesn't meet the required conditions,
3179 /// an error message is generated.
3180 ///
3181 /// ```proto
3182 /// message MyTimestamp {
3183 /// // timestamp must be greater than '2023-01-01T00:00:00Z' \[timestamp.gt\]
3184 /// google.protobuf.Timestamp value = 1 \[(buf.validate.field).timestamp.gt = { seconds: 1672444800 }\];
3185 ///
3186 /// // timestamp must be greater than '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' \[timestamp.gt_lt\]
3187 /// google.protobuf.Timestamp another_value = 2 \[(buf.validate.field).timestamp = { gt: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }\];
3188 ///
3189 /// // timestamp must be greater than '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' \[timestamp.gt_lt_exclusive\]
3190 /// google.protobuf.Timestamp other_value = 3 \[(buf.validate.field).timestamp = { gt: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }\];
3191 /// }
3192 /// ```
3193 #[prost(message, tag = "5")]
3194 Gt(crate::protobuf::Timestamp),
3195 /// `gte` requires the timestamp field value to be greater than or equal to the
3196 /// specified value (exclusive). If the value of `gte` is larger than a
3197 /// specified `lt` or `lte`, the range is reversed, and the field value
3198 /// must be outside the specified range. If the field value doesn't meet
3199 /// the required conditions, an error message is generated.
3200 ///
3201 /// ```proto
3202 /// message MyTimestamp {
3203 /// // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' \[timestamp.gte\]
3204 /// google.protobuf.Timestamp value = 1 \[(buf.validate.field).timestamp.gte = { seconds: 1672444800 }\];
3205 ///
3206 /// // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' \[timestamp.gte_lt\]
3207 /// google.protobuf.Timestamp another_value = 2 \[(buf.validate.field).timestamp = { gte: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }\];
3208 ///
3209 /// // timestamp must be greater than or equal to '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' \[timestamp.gte_lt_exclusive\]
3210 /// google.protobuf.Timestamp other_value = 3 \[(buf.validate.field).timestamp = { gte: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }\];
3211 /// }
3212 /// ```
3213 #[prost(message, tag = "6")]
3214 Gte(crate::protobuf::Timestamp),
3215 /// `gt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be greater than the current time. `gt_now` can only be used with the `within` rule.
3216 ///
3217 /// ```proto
3218 /// message MyTimestamp {
3219 /// // value must be greater than now
3220 /// google.protobuf.Timestamp created_at = 1 \[(buf.validate.field).timestamp.gt_now = true\];
3221 /// }
3222 /// ```
3223 #[prost(bool, tag = "8")]
3224 GtNow(bool),
3225 }
3226}
3227/// `Violations` is a collection of `Violation` messages. This message type is returned by
3228/// Protovalidate when a proto message fails to meet the requirements set by the `Rule` validation rules.
3229/// Each individual violation is represented by a `Violation` message.
3230#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3231pub struct Violations {
3232 /// `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected.
3233 #[prost(message, repeated, tag = "1")]
3234 pub violations: ::prost::alloc::vec::Vec<Violation>,
3235}
3236/// `Violation` represents a single instance where a validation rule, expressed
3237/// as a `Rule`, was not met. It provides information about the field that
3238/// caused the violation, the specific rule that wasn't fulfilled, and a
3239/// human-readable error message.
3240///
3241/// For example, consider the following message:
3242///
3243/// ```proto
3244/// message User {
3245/// int32 age = 1 [(buf.validate.field).cel = {
3246/// id: "user.age",
3247/// expression: "this < 18 ? 'User must be at least 18 years old' : ''",
3248/// }];
3249/// }
3250/// ```
3251///
3252/// It could produce the following violation:
3253///
3254/// ```json
3255/// {
3256/// "ruleId": "user.age",
3257/// "message": "User must be at least 18 years old",
3258/// "field": {
3259/// "elements": [
3260/// {
3261/// "fieldNumber": 1,
3262/// "fieldName": "age",
3263/// "fieldType": "TYPE_INT32"
3264/// }
3265/// ]
3266/// },
3267/// "rule": {
3268/// "elements": [
3269/// {
3270/// "fieldNumber": 23,
3271/// "fieldName": "cel",
3272/// "fieldType": "TYPE_MESSAGE",
3273/// "index": "0"
3274/// }
3275/// ]
3276/// }
3277/// }
3278/// ```
3279#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3280pub struct Violation {
3281 /// `field` is a machine-readable path to the field that failed validation.
3282 /// This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
3283 ///
3284 /// For example, consider the following message:
3285 ///
3286 /// ```proto
3287 /// message Message {
3288 /// bool a = 1 \[(buf.validate.field).required = true\];
3289 /// }
3290 /// ```
3291 ///
3292 /// It could produce the following violation:
3293 ///
3294 /// ```textproto
3295 /// violation {
3296 /// field { element { field_number: 1, field_name: "a", field_type: 8 } }
3297 /// ...
3298 /// }
3299 /// ```
3300 #[prost(message, optional, tag = "5")]
3301 pub field: ::core::option::Option<FieldPath>,
3302 /// `rule` is a machine-readable path that points to the specific rule that failed validation.
3303 /// This will be a nested field starting from the FieldRules of the field that failed validation.
3304 /// For custom rules, this will provide the path of the rule, e.g. `cel\[0\]`.
3305 ///
3306 /// For example, consider the following message:
3307 ///
3308 /// ```proto
3309 /// message Message {
3310 /// bool a = 1 \[(buf.validate.field).required = true\];
3311 /// bool b = 2 [(buf.validate.field).cel = {
3312 /// id: "custom_rule",
3313 /// expression: "!this ? 'b must be true': ''"
3314 /// }]
3315 /// }
3316 /// ```
3317 ///
3318 /// It could produce the following violations:
3319 ///
3320 /// ```textproto
3321 /// violation {
3322 /// rule { element { field_number: 25, field_name: "required", field_type: 8 } }
3323 /// ...
3324 /// }
3325 /// violation {
3326 /// rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } }
3327 /// ...
3328 /// }
3329 /// ```
3330 #[prost(message, optional, tag = "6")]
3331 pub rule: ::core::option::Option<FieldPath>,
3332 /// `rule_id` is the unique identifier of the `Rule` that was not fulfilled.
3333 /// This is the same `id` that was specified in the `Rule` message, allowing easy tracing of which rule was violated.
3334 #[prost(string, optional, tag = "2")]
3335 pub rule_id: ::core::option::Option<::prost::alloc::string::String>,
3336 /// `message` is a human-readable error message that describes the nature of the violation.
3337 /// This can be the default error message from the violated `Rule`, or it can be a custom message that gives more context about the violation.
3338 #[prost(string, optional, tag = "3")]
3339 pub message: ::core::option::Option<::prost::alloc::string::String>,
3340 /// `for_key` indicates whether the violation was caused by a map key, rather than a value.
3341 #[prost(bool, optional, tag = "4")]
3342 pub for_key: ::core::option::Option<bool>,
3343}
3344/// `FieldPath` provides a path to a nested protobuf field.
3345///
3346/// This message provides enough information to render a dotted field path even without protobuf descriptors.
3347/// It also provides enough information to resolve a nested field through unknown wire data.
3348#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3349pub struct FieldPath {
3350 /// `elements` contains each element of the path, starting from the root and recursing downward.
3351 #[prost(message, repeated, tag = "1")]
3352 pub elements: ::prost::alloc::vec::Vec<FieldPathElement>,
3353}
3354/// `FieldPathElement` provides enough information to nest through a single protobuf field.
3355///
3356/// If the selected field is a map or repeated field, the `subscript` value selects a specific element from it.
3357/// A path that refers to a value nested under a map key or repeated field index will have a `subscript` value.
3358/// The `field_type` field allows unambiguous resolution of a field even if descriptors are not available.
3359#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3360pub struct FieldPathElement {
3361 /// `field_number` is the field number this path element refers to.
3362 #[prost(int32, optional, tag = "1")]
3363 pub field_number: ::core::option::Option<i32>,
3364 /// `field_name` contains the field name this path element refers to.
3365 /// This can be used to display a human-readable path even if the field number is unknown.
3366 #[prost(string, optional, tag = "2")]
3367 pub field_name: ::core::option::Option<::prost::alloc::string::String>,
3368 /// `field_type` specifies the type of this field. When using reflection, this value is not needed.
3369 ///
3370 /// This value is provided to make it possible to traverse unknown fields through wire data.
3371 /// When traversing wire data, be mindful of both packed\[1\] and delimited\[2\] encoding schemes.
3372 ///
3373 /// \[1\]: <https://protobuf.dev/programming-guides/encoding/#packed>
3374 /// \[2\]: <https://protobuf.dev/programming-guides/encoding/#groups>
3375 ///
3376 /// N.B.: Although groups are deprecated, the corresponding delimited encoding scheme is not, and
3377 /// can be explicitly used in Protocol Buffers 2023 Edition.
3378 #[prost(
3379 enumeration = "crate::protobuf::field_descriptor_proto::Type",
3380 optional,
3381 tag = "3"
3382 )]
3383 pub field_type: ::core::option::Option<i32>,
3384 /// `key_type` specifies the map key type of this field. This value is useful when traversing
3385 /// unknown fields through wire data: specifically, it allows handling the differences between
3386 /// different integer encodings.
3387 #[prost(
3388 enumeration = "crate::protobuf::field_descriptor_proto::Type",
3389 optional,
3390 tag = "4"
3391 )]
3392 pub key_type: ::core::option::Option<i32>,
3393 /// `value_type` specifies map value type of this field. This is useful if you want to display a
3394 /// value inside unknown fields through wire data.
3395 #[prost(
3396 enumeration = "crate::protobuf::field_descriptor_proto::Type",
3397 optional,
3398 tag = "5"
3399 )]
3400 pub value_type: ::core::option::Option<i32>,
3401 /// `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field.
3402 #[prost(oneof = "field_path_element::Subscript", tags = "6, 7, 8, 9, 10")]
3403 pub subscript: ::core::option::Option<field_path_element::Subscript>,
3404}
3405/// Nested message and enum types in `FieldPathElement`.
3406pub mod field_path_element {
3407 /// `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field.
3408 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
3409 pub enum Subscript {
3410 /// `index` specifies a 0-based index into a repeated field.
3411 #[prost(uint64, tag = "6")]
3412 Index(u64),
3413 /// `bool_key` specifies a map key of type bool.
3414 #[prost(bool, tag = "7")]
3415 BoolKey(bool),
3416 /// `int_key` specifies a map key of type int32, int64, sint32, sint64, sfixed32 or sfixed64.
3417 #[prost(int64, tag = "8")]
3418 IntKey(i64),
3419 /// `uint_key` specifies a map key of type uint32, uint64, fixed32 or fixed64.
3420 #[prost(uint64, tag = "9")]
3421 UintKey(u64),
3422 /// `string_key` specifies a map key of type string.
3423 #[prost(string, tag = "10")]
3424 StringKey(::prost::alloc::string::String),
3425 }
3426}
3427/// Specifies how `FieldRules.ignore` behaves, depending on the field's value, and
3428/// whether the field tracks presence.
3429#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3430#[repr(i32)]
3431#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3432pub enum Ignore {
3433 /// Ignore rules if the field tracks presence and is unset. This is the default
3434 /// behavior.
3435 ///
3436 /// In proto3, only message fields, members of a Protobuf `oneof`, and fields
3437 /// with the `optional` label track presence. Consequently, the following fields
3438 /// are always validated, whether a value is set or not:
3439 ///
3440 /// ```proto
3441 /// syntax="proto3";
3442 ///
3443 /// message RulesApply {
3444 /// string email = 1 [
3445 /// (buf.validate.field).string.email = true
3446 /// ];
3447 /// int32 age = 2 [
3448 /// (buf.validate.field).int32.gt = 0
3449 /// ];
3450 /// repeated string labels = 3 [
3451 /// (buf.validate.field).repeated.min_items = 1
3452 /// ];
3453 /// }
3454 /// ```
3455 ///
3456 /// In contrast, the following fields track presence, and are only validated if
3457 /// a value is set:
3458 ///
3459 /// ```proto
3460 /// syntax="proto3";
3461 ///
3462 /// message RulesApplyIfSet {
3463 /// optional string email = 1 [
3464 /// (buf.validate.field).string.email = true
3465 /// ];
3466 /// oneof ref {
3467 /// string reference = 2 [
3468 /// (buf.validate.field).string.uuid = true
3469 /// ];
3470 /// string name = 3 [
3471 /// (buf.validate.field).string.min_len = 4
3472 /// ];
3473 /// }
3474 /// SomeMessage msg = 4 [
3475 /// (buf.validate.field).cel = {/* ... */}
3476 /// ];
3477 /// }
3478 /// ```
3479 ///
3480 /// To ensure that such a field is set, add the `required` rule.
3481 ///
3482 /// To learn which fields track presence, see the
3483 /// [Field Presence cheat sheet](<https://protobuf.dev/programming-guides/field_presence/#cheat>).
3484 Unspecified = 0,
3485 /// Ignore rules if the field is unset, or set to the zero value.
3486 ///
3487 /// The zero value depends on the field type:
3488 /// - For strings, the zero value is the empty string.
3489 /// - For bytes, the zero value is empty bytes.
3490 /// - For bool, the zero value is false.
3491 /// - For numeric types, the zero value is zero.
3492 /// - For enums, the zero value is the first defined enum value.
3493 /// - For repeated fields, the zero is an empty list.
3494 /// - For map fields, the zero is an empty map.
3495 /// - For message fields, absence of the message (typically a null-value) is considered zero value.
3496 ///
3497 /// For fields that track presence (e.g. adding the `optional` label in proto3),
3498 /// this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`.
3499 IfZeroValue = 1,
3500 /// Always ignore rules, including the `required` rule.
3501 ///
3502 /// This is useful for ignoring the rules of a referenced message, or to
3503 /// temporarily ignore rules during development.
3504 ///
3505 /// ```proto
3506 /// message MyMessage {
3507 /// // The field's rules will always be ignored, including any validations
3508 /// // on value's fields.
3509 /// MyOtherMessage value = 1 [
3510 /// (buf.validate.field).ignore = IGNORE_ALWAYS
3511 /// ];
3512 /// }
3513 /// ```
3514 Always = 3,
3515}
3516impl Ignore {
3517 /// String value of the enum field names used in the ProtoBuf definition.
3518 ///
3519 /// The values are not transformed in any way and thus are considered stable
3520 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3521 #[must_use]
3522 pub const fn as_str_name(&self) -> &'static str {
3523 match self {
3524 Self::Unspecified => "IGNORE_UNSPECIFIED",
3525 Self::IfZeroValue => "IGNORE_IF_ZERO_VALUE",
3526 Self::Always => "IGNORE_ALWAYS",
3527 }
3528 }
3529 /// Creates an enum from field names used in the ProtoBuf definition.
3530 #[must_use]
3531 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3532 match value {
3533 "IGNORE_UNSPECIFIED" => Some(Self::Unspecified),
3534 "IGNORE_IF_ZERO_VALUE" => Some(Self::IfZeroValue),
3535 "IGNORE_ALWAYS" => Some(Self::Always),
3536 _ => None,
3537 }
3538 }
3539}
3540/// KnownRegex contains some well-known patterns.
3541#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3542#[repr(i32)]
3543pub enum KnownRegex {
3544 Unspecified = 0,
3545 /// HTTP header name as defined by [RFC 7230](<https://datatracker.ietf.org/doc/html/rfc7230#section-3.2>).
3546 HttpHeaderName = 1,
3547 /// HTTP header value as defined by [RFC 7230](<https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4>).
3548 HttpHeaderValue = 2,
3549}
3550impl KnownRegex {
3551 /// String value of the enum field names used in the ProtoBuf definition.
3552 ///
3553 /// The values are not transformed in any way and thus are considered stable
3554 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3555 #[must_use]
3556 pub const fn as_str_name(&self) -> &'static str {
3557 match self {
3558 Self::Unspecified => "KNOWN_REGEX_UNSPECIFIED",
3559 Self::HttpHeaderName => "KNOWN_REGEX_HTTP_HEADER_NAME",
3560 Self::HttpHeaderValue => "KNOWN_REGEX_HTTP_HEADER_VALUE",
3561 }
3562 }
3563 /// Creates an enum from field names used in the ProtoBuf definition.
3564 #[must_use]
3565 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3566 match value {
3567 "KNOWN_REGEX_UNSPECIFIED" => Some(Self::Unspecified),
3568 "KNOWN_REGEX_HTTP_HEADER_NAME" => Some(Self::HttpHeaderName),
3569 "KNOWN_REGEX_HTTP_HEADER_VALUE" => Some(Self::HttpHeaderValue),
3570 _ => None,
3571 }
3572 }
3573}