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