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