plexspaces 0.1.1__py3-none-any.whl

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