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