@fatehan/tsrp 1.3.47 → 1.3.49

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