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