@mochabug/adaptkit 1.0.0-rc.16 → 1.0.0-rc.17

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.
@@ -111,20 +111,6 @@ export declare const RuleSchema: GenMessage<Rule, {
111
111
  * @generated from message buf.validate.MessageRules
112
112
  */
113
113
  export type MessageRules = Message<"buf.validate.MessageRules"> & {
114
- /**
115
- * `disabled` is a boolean flag that, when set to true, nullifies any validation rules for this message.
116
- * This includes any fields within the message that would otherwise support validation.
117
- *
118
- * ```proto
119
- * message MyMessage {
120
- * // validation will be bypassed for this message
121
- * option (buf.validate.message).disabled = true;
122
- * }
123
- * ```
124
- *
125
- * @generated from field: optional bool disabled = 1;
126
- */
127
- disabled: boolean;
128
114
  /**
129
115
  * `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message.
130
116
  * These rules are written in Common Expression Language (CEL) syntax. For more information,
@@ -165,7 +151,7 @@ export type MessageRules = Message<"buf.validate.MessageRules"> & {
165
151
  * silently ignored when unmarshalling, with only the last field being set when
166
152
  * unmarshalling completes.
167
153
  *
168
- * Note that adding a field to a `oneof` will also set the IGNORE_IF_UNPOPULATED on the fields. This means
154
+ * Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means
169
155
  * only the field that is set will be validated and the unset fields are not validated according to the field rules.
170
156
  * This behavior can be overridden by setting `ignore` against a field.
171
157
  *
@@ -193,20 +179,6 @@ export type MessageRules = Message<"buf.validate.MessageRules"> & {
193
179
  * @generated from message buf.validate.MessageRules
194
180
  */
195
181
  export type MessageRulesJson = {
196
- /**
197
- * `disabled` is a boolean flag that, when set to true, nullifies any validation rules for this message.
198
- * This includes any fields within the message that would otherwise support validation.
199
- *
200
- * ```proto
201
- * message MyMessage {
202
- * // validation will be bypassed for this message
203
- * option (buf.validate.message).disabled = true;
204
- * }
205
- * ```
206
- *
207
- * @generated from field: optional bool disabled = 1;
208
- */
209
- disabled?: boolean;
210
182
  /**
211
183
  * `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message.
212
184
  * These rules are written in Common Expression Language (CEL) syntax. For more information,
@@ -247,7 +219,7 @@ export type MessageRulesJson = {
247
219
  * silently ignored when unmarshalling, with only the last field being set when
248
220
  * unmarshalling completes.
249
221
  *
250
- * Note that adding a field to a `oneof` will also set the IGNORE_IF_UNPOPULATED on the fields. This means
222
+ * Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means
251
223
  * only the field that is set will be validated and the unset fields are not validated according to the field rules.
252
224
  * This behavior can be overridden by setting `ignore` against a field.
253
225
  *
@@ -328,9 +300,8 @@ export declare const MessageOneofRuleSchema: GenMessage<MessageOneofRule, {
328
300
  */
329
301
  export type OneofRules = Message<"buf.validate.OneofRules"> & {
330
302
  /**
331
- * If `required` is true, exactly one field of the oneof must be present. A
332
- * validation error is returned if no fields in the oneof are present. The
333
- * field itself may still be a default value; further rules
303
+ * If `required` is true, exactly one field of the oneof must be set. A
304
+ * validation error is returned if no fields in the oneof are set. Further rules
334
305
  * should be placed on the fields themselves to ensure they are valid values,
335
306
  * such as `min_len` or `gt`.
336
307
  *
@@ -358,9 +329,8 @@ export type OneofRules = Message<"buf.validate.OneofRules"> & {
358
329
  */
359
330
  export type OneofRulesJson = {
360
331
  /**
361
- * If `required` is true, exactly one field of the oneof must be present. A
362
- * validation error is returned if no fields in the oneof are present. The
363
- * field itself may still be a default value; further rules
332
+ * If `required` is true, exactly one field of the oneof must be set. A
333
+ * validation error is returned if no fields in the oneof are set. Further rules
364
334
  * should be placed on the fields themselves to ensure they are valid values,
365
335
  * such as `min_len` or `gt`.
366
336
  *
@@ -414,39 +384,70 @@ export type FieldRules = Message<"buf.validate.FieldRules"> & {
414
384
  */
415
385
  cel: Rule[];
416
386
  /**
417
- * If `required` is true, the field must be populated. A populated field can be
418
- * described as "serialized in the wire format," which includes:
387
+ * If `required` is true, the field must be set. A validation error is returned
388
+ * if the field is not set.
389
+ *
390
+ * ```proto
391
+ * syntax="proto3";
392
+ *
393
+ * message FieldsWithPresence {
394
+ * // Requires any string to be set, including the empty string.
395
+ * optional string link = 1 [
396
+ * (buf.validate.field).required = true
397
+ * ];
398
+ * // Requires true or false to be set.
399
+ * optional bool disabled = 2 [
400
+ * (buf.validate.field).required = true
401
+ * ];
402
+ * // Requires a message to be set, including the empty message.
403
+ * SomeMessage msg = 4 [
404
+ * (buf.validate.field).required = true
405
+ * ];
406
+ * }
407
+ * ```
408
+ *
409
+ * All fields in the example above track presence. By default, Protovalidate
410
+ * ignores rules on those fields if no value is set. `required` ensures that
411
+ * the fields are set and valid.
419
412
  *
420
- * - the following "nullable" fields must be explicitly set to be considered populated:
421
- * - singular message fields (whose fields may be unpopulated/default values)
422
- * - member fields of a oneof (may be their default value)
423
- * - proto3 optional fields (may be their default value)
424
- * - proto2 scalar fields (both optional and required)
425
- * - proto3 scalar fields must be non-zero to be considered populated
426
- * - repeated and map fields must be non-empty to be considered populated
427
- * - map keys/values and repeated items are always considered populated
413
+ * Fields that don't track presence are always validated by Protovalidate,
414
+ * whether they are set or not. It is not necessary to add `required`:
428
415
  *
429
416
  * ```proto
430
- * message MyMessage {
431
- * // The field `value` must be set to a non-null value.
432
- * optional MyOtherMessage value = 1 [(buf.validate.field).required = true];
417
+ * syntax="proto3";
418
+ *
419
+ * message FieldsWithoutPresence {
420
+ * // `string.email` always applies, even to an empty string.
421
+ * string link = 1 [
422
+ * (buf.validate.field).string.email = true
423
+ * ];
424
+ * // `repeated.min_items` always applies, even to an empty list.
425
+ * repeated string labels = 4 [
426
+ * (buf.validate.field).repeated.min_items = 1
427
+ * ];
433
428
  * }
434
429
  * ```
435
430
  *
431
+ * To learn which fields track presence, see the
432
+ * [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
433
+ *
434
+ * Note: While field rules can be applied to repeated items, map keys, and map
435
+ * values, the elements are always considered to be set. Consequently,
436
+ * specifying `repeated.items.required` is redundant.
437
+ *
436
438
  * @generated from field: optional bool required = 25;
437
439
  */
438
440
  required: boolean;
439
441
  /**
440
- * Skip validation on the field if its value matches the specified criteria.
441
- * See Ignore enum for details.
442
+ * Ignore validation rules on the field if its value matches the specified
443
+ * criteria. See the `Ignore` enum for details.
442
444
  *
443
445
  * ```proto
444
446
  * message UpdateRequest {
445
- * // The uri rule only applies if the field is populated and not an empty
446
- * // string.
447
- * optional string url = 1 [
448
- * (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE,
449
- * (buf.validate.field).string.uri = true,
447
+ * // The uri rule only applies if the field is not an empty string.
448
+ * string url = 1 [
449
+ * (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE,
450
+ * (buf.validate.field).string.uri = true
450
451
  * ];
451
452
  * }
452
453
  * ```
@@ -621,39 +622,70 @@ export type FieldRulesJson = {
621
622
  */
622
623
  cel?: RuleJson[];
623
624
  /**
624
- * If `required` is true, the field must be populated. A populated field can be
625
- * described as "serialized in the wire format," which includes:
625
+ * If `required` is true, the field must be set. A validation error is returned
626
+ * if the field is not set.
627
+ *
628
+ * ```proto
629
+ * syntax="proto3";
630
+ *
631
+ * message FieldsWithPresence {
632
+ * // Requires any string to be set, including the empty string.
633
+ * optional string link = 1 [
634
+ * (buf.validate.field).required = true
635
+ * ];
636
+ * // Requires true or false to be set.
637
+ * optional bool disabled = 2 [
638
+ * (buf.validate.field).required = true
639
+ * ];
640
+ * // Requires a message to be set, including the empty message.
641
+ * SomeMessage msg = 4 [
642
+ * (buf.validate.field).required = true
643
+ * ];
644
+ * }
645
+ * ```
626
646
  *
627
- * - the following "nullable" fields must be explicitly set to be considered populated:
628
- * - singular message fields (whose fields may be unpopulated/default values)
629
- * - member fields of a oneof (may be their default value)
630
- * - proto3 optional fields (may be their default value)
631
- * - proto2 scalar fields (both optional and required)
632
- * - proto3 scalar fields must be non-zero to be considered populated
633
- * - repeated and map fields must be non-empty to be considered populated
634
- * - map keys/values and repeated items are always considered populated
647
+ * All fields in the example above track presence. By default, Protovalidate
648
+ * ignores rules on those fields if no value is set. `required` ensures that
649
+ * the fields are set and valid.
650
+ *
651
+ * Fields that don't track presence are always validated by Protovalidate,
652
+ * whether they are set or not. It is not necessary to add `required`:
635
653
  *
636
654
  * ```proto
637
- * message MyMessage {
638
- * // The field `value` must be set to a non-null value.
639
- * optional MyOtherMessage value = 1 [(buf.validate.field).required = true];
655
+ * syntax="proto3";
656
+ *
657
+ * message FieldsWithoutPresence {
658
+ * // `string.email` always applies, even to an empty string.
659
+ * string link = 1 [
660
+ * (buf.validate.field).string.email = true
661
+ * ];
662
+ * // `repeated.min_items` always applies, even to an empty list.
663
+ * repeated string labels = 4 [
664
+ * (buf.validate.field).repeated.min_items = 1
665
+ * ];
640
666
  * }
641
667
  * ```
642
668
  *
669
+ * To learn which fields track presence, see the
670
+ * [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
671
+ *
672
+ * Note: While field rules can be applied to repeated items, map keys, and map
673
+ * values, the elements are always considered to be set. Consequently,
674
+ * specifying `repeated.items.required` is redundant.
675
+ *
643
676
  * @generated from field: optional bool required = 25;
644
677
  */
645
678
  required?: boolean;
646
679
  /**
647
- * Skip validation on the field if its value matches the specified criteria.
648
- * See Ignore enum for details.
680
+ * Ignore validation rules on the field if its value matches the specified
681
+ * criteria. See the `Ignore` enum for details.
649
682
  *
650
683
  * ```proto
651
684
  * message UpdateRequest {
652
- * // The uri rule only applies if the field is populated and not an empty
653
- * // string.
654
- * optional string url = 1 [
655
- * (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE,
656
- * (buf.validate.field).string.uri = true,
685
+ * // The uri rule only applies if the field is not an empty string.
686
+ * string url = 1 [
687
+ * (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE,
688
+ * (buf.validate.field).string.uri = true
657
689
  * ];
658
690
  * }
659
691
  * ```
@@ -6728,10 +6760,7 @@ export type RepeatedRules = Message<"buf.validate.RepeatedRules"> & {
6728
6760
  /**
6729
6761
  * `items` details the rules to be applied to each item
6730
6762
  * in the field. Even for repeated message fields, validation is executed
6731
- * against each item unless skip is explicitly specified.
6732
- *
6733
- * Note that repeated items are always considered populated. The `required`
6734
- * rule does not apply.
6763
+ * against each item unless `ignore` is specified.
6735
6764
  *
6736
6765
  * ```proto
6737
6766
  * message MyRepeated {
@@ -6745,6 +6774,9 @@ export type RepeatedRules = Message<"buf.validate.RepeatedRules"> & {
6745
6774
  * }
6746
6775
  * ```
6747
6776
  *
6777
+ * Note that the `required` rule does not apply. Repeated items
6778
+ * cannot be unset.
6779
+ *
6748
6780
  * @generated from field: optional buf.validate.FieldRules items = 4;
6749
6781
  */
6750
6782
  items?: FieldRules;
@@ -6805,10 +6837,7 @@ export type RepeatedRulesJson = {
6805
6837
  /**
6806
6838
  * `items` details the rules to be applied to each item
6807
6839
  * in the field. Even for repeated message fields, validation is executed
6808
- * against each item unless skip is explicitly specified.
6809
- *
6810
- * Note that repeated items are always considered populated. The `required`
6811
- * rule does not apply.
6840
+ * against each item unless `ignore` is specified.
6812
6841
  *
6813
6842
  * ```proto
6814
6843
  * message MyRepeated {
@@ -6822,6 +6851,9 @@ export type RepeatedRulesJson = {
6822
6851
  * }
6823
6852
  * ```
6824
6853
  *
6854
+ * Note that the `required` rule does not apply. Repeated items
6855
+ * cannot be unset.
6856
+ *
6825
6857
  * @generated from field: optional buf.validate.FieldRules items = 4;
6826
6858
  */
6827
6859
  items?: FieldRulesJson;
@@ -6870,9 +6902,6 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
6870
6902
  /**
6871
6903
  * Specifies the rules to be applied to each key in the field.
6872
6904
  *
6873
- * Note that map keys are always considered populated. The `required`
6874
- * rule does not apply.
6875
- *
6876
6905
  * ```proto
6877
6906
  * message MyMap {
6878
6907
  * // The keys in the field `value` must follow the specified rules.
@@ -6885,16 +6914,15 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
6885
6914
  * }
6886
6915
  * ```
6887
6916
  *
6917
+ * Note that the `required` rule does not apply. Map keys cannot be unset.
6918
+ *
6888
6919
  * @generated from field: optional buf.validate.FieldRules keys = 4;
6889
6920
  */
6890
6921
  keys?: FieldRules;
6891
6922
  /**
6892
6923
  * Specifies the rules to be applied to the value of each key in the
6893
6924
  * field. Message values will still have their validations evaluated unless
6894
- * skip is specified here.
6895
- *
6896
- * Note that map values are always considered populated. The `required`
6897
- * rule does not apply.
6925
+ * `ignore` is specified.
6898
6926
  *
6899
6927
  * ```proto
6900
6928
  * message MyMap {
@@ -6907,6 +6935,7 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
6907
6935
  * }];
6908
6936
  * }
6909
6937
  * ```
6938
+ * Note that the `required` rule does not apply. Map values cannot be unset.
6910
6939
  *
6911
6940
  * @generated from field: optional buf.validate.FieldRules values = 5;
6912
6941
  */
@@ -6949,9 +6978,6 @@ export type MapRulesJson = {
6949
6978
  /**
6950
6979
  * Specifies the rules to be applied to each key in the field.
6951
6980
  *
6952
- * Note that map keys are always considered populated. The `required`
6953
- * rule does not apply.
6954
- *
6955
6981
  * ```proto
6956
6982
  * message MyMap {
6957
6983
  * // The keys in the field `value` must follow the specified rules.
@@ -6964,16 +6990,15 @@ export type MapRulesJson = {
6964
6990
  * }
6965
6991
  * ```
6966
6992
  *
6993
+ * Note that the `required` rule does not apply. Map keys cannot be unset.
6994
+ *
6967
6995
  * @generated from field: optional buf.validate.FieldRules keys = 4;
6968
6996
  */
6969
6997
  keys?: FieldRulesJson;
6970
6998
  /**
6971
6999
  * Specifies the rules to be applied to the value of each key in the
6972
7000
  * field. Message values will still have their validations evaluated unless
6973
- * skip is specified here.
6974
- *
6975
- * Note that map values are always considered populated. The `required`
6976
- * rule does not apply.
7001
+ * `ignore` is specified.
6977
7002
  *
6978
7003
  * ```proto
6979
7004
  * message MyMap {
@@ -6986,6 +7011,7 @@ export type MapRulesJson = {
6986
7011
  * }];
6987
7012
  * }
6988
7013
  * ```
7014
+ * Note that the `required` rule does not apply. Map values cannot be unset.
6989
7015
  *
6990
7016
  * @generated from field: optional buf.validate.FieldRules values = 5;
6991
7017
  */
@@ -8263,157 +8289,96 @@ export declare const FieldPathElementSchema: GenMessage<FieldPathElement, {
8263
8289
  jsonType: FieldPathElementJson;
8264
8290
  }>;
8265
8291
  /**
8266
- * Specifies how FieldRules.ignore behaves. See the documentation for
8267
- * FieldRules.required for definitions of "populated" and "nullable".
8292
+ * Specifies how `FieldRules.ignore` behaves, depending on the field's value, and
8293
+ * whether the field tracks presence.
8268
8294
  *
8269
8295
  * @generated from enum buf.validate.Ignore
8270
8296
  */
8271
8297
  export declare enum Ignore {
8272
8298
  /**
8273
- * Validation is only skipped if it's an unpopulated nullable field.
8299
+ * Ignore rules if the field tracks presence and is unset. This is the default
8300
+ * behavior.
8301
+ *
8302
+ * In proto3, only message fields, members of a Protobuf `oneof`, and fields
8303
+ * with the `optional` label track presence. Consequently, the following fields
8304
+ * are always validated, whether a value is set or not:
8274
8305
  *
8275
8306
  * ```proto
8276
8307
  * syntax="proto3";
8277
8308
  *
8278
- * message Request {
8279
- * // The uri rule applies to any value, including the empty string.
8280
- * string foo = 1 [
8281
- * (buf.validate.field).string.uri = true
8282
- * ];
8283
- *
8284
- * // The uri rule only applies if the field is set, including if it's
8285
- * // set to the empty string.
8286
- * optional string bar = 2 [
8287
- * (buf.validate.field).string.uri = true
8309
+ * message RulesApply {
8310
+ * string email = 1 [
8311
+ * (buf.validate.field).string.email = true
8288
8312
  * ];
8289
- *
8290
- * // The min_items rule always applies, even if the list is empty.
8291
- * repeated string baz = 3 [
8292
- * (buf.validate.field).repeated.min_items = 3
8313
+ * int32 age = 2 [
8314
+ * (buf.validate.field).int32.gt = 0
8293
8315
  * ];
8294
- *
8295
- * // The custom CEL rule applies only if the field is set, including if
8296
- * // it's the "zero" value of that message.
8297
- * SomeMessage quux = 4 [
8298
- * (buf.validate.field).cel = {/* ... *\/}
8316
+ * repeated string labels = 3 [
8317
+ * (buf.validate.field).repeated.min_items = 1
8299
8318
  * ];
8300
8319
  * }
8301
8320
  * ```
8302
8321
  *
8303
- * @generated from enum value: IGNORE_UNSPECIFIED = 0;
8304
- */
8305
- UNSPECIFIED = 0,
8306
- /**
8307
- * Validation is skipped if the field is unpopulated. This rule is redundant
8308
- * if the field is already nullable.
8322
+ * In contrast, the following fields track presence, and are only validated if
8323
+ * a value is set:
8309
8324
  *
8310
8325
  * ```proto
8311
- * syntax="proto3
8312
- *
8313
- * message Request {
8314
- * // The uri rule applies only if the value is not the empty string.
8315
- * string foo = 1 [
8316
- * (buf.validate.field).string.uri = true,
8317
- * (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
8318
- * ];
8319
- *
8320
- * // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this
8321
- * // case: the uri rule only applies if the field is set, including if
8322
- * // it's set to the empty string.
8323
- * optional string bar = 2 [
8324
- * (buf.validate.field).string.uri = true,
8325
- * (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
8326
- * ];
8326
+ * syntax="proto3";
8327
8327
  *
8328
- * // The min_items rule only applies if the list has at least one item.
8329
- * repeated string baz = 3 [
8330
- * (buf.validate.field).repeated.min_items = 3,
8331
- * (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
8328
+ * message RulesApplyIfSet {
8329
+ * optional string email = 1 [
8330
+ * (buf.validate.field).string.email = true
8332
8331
  * ];
8333
- *
8334
- * // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this
8335
- * // case: the custom CEL rule applies only if the field is set, including
8336
- * // if it's the "zero" value of that message.
8337
- * SomeMessage quux = 4 [
8338
- * (buf.validate.field).cel = {/* ... *\/},
8339
- * (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
8332
+ * oneof ref {
8333
+ * string reference = 2 [
8334
+ * (buf.validate.field).string.uuid = true
8335
+ * ];
8336
+ * string name = 3 [
8337
+ * (buf.validate.field).string.min_len = 4
8338
+ * ];
8339
+ * }
8340
+ * SomeMessage msg = 4 [
8341
+ * (buf.validate.field).cel = {/* ... *\/}
8340
8342
  * ];
8341
8343
  * }
8342
8344
  * ```
8343
8345
  *
8344
- * @generated from enum value: IGNORE_IF_UNPOPULATED = 1;
8345
- */
8346
- IF_UNPOPULATED = 1,
8347
- /**
8348
- * Validation is skipped if the field is unpopulated or if it is a nullable
8349
- * field populated with its default value. This is typically the zero or
8350
- * empty value, but proto2 scalars support custom defaults. For messages, the
8351
- * default is a non-null message with all its fields unpopulated.
8346
+ * To ensure that such a field is set, add the `required` rule.
8352
8347
  *
8353
- * ```proto
8354
- * syntax="proto3
8355
- *
8356
- * message Request {
8357
- * // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in
8358
- * // this case; the uri rule applies only if the value is not the empty
8359
- * // string.
8360
- * string foo = 1 [
8361
- * (buf.validate.field).string.uri = true,
8362
- * (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
8363
- * ];
8364
- *
8365
- * // The uri rule only applies if the field is set to a value other than
8366
- * // the empty string.
8367
- * optional string bar = 2 [
8368
- * (buf.validate.field).string.uri = true,
8369
- * (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
8370
- * ];
8371
- *
8372
- * // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in
8373
- * // this case; the min_items rule only applies if the list has at least
8374
- * // one item.
8375
- * repeated string baz = 3 [
8376
- * (buf.validate.field).repeated.min_items = 3,
8377
- * (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
8378
- * ];
8348
+ * To learn which fields track presence, see the
8349
+ * [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
8379
8350
  *
8380
- * // The custom CEL rule only applies if the field is set to a value other
8381
- * // than an empty message (i.e., fields are unpopulated).
8382
- * SomeMessage quux = 4 [
8383
- * (buf.validate.field).cel = {/* ... *\/},
8384
- * (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
8385
- * ];
8386
- * }
8387
- * ```
8388
- *
8389
- * This rule is affected by proto2 custom default values:
8351
+ * @generated from enum value: IGNORE_UNSPECIFIED = 0;
8352
+ */
8353
+ UNSPECIFIED = 0,
8354
+ /**
8355
+ * Ignore rules if the field is unset, or set to the zero value.
8390
8356
  *
8391
- * ```proto
8392
- * syntax="proto2";
8357
+ * The zero value depends on the field type:
8358
+ * - For strings, the zero value is the empty string.
8359
+ * - For bytes, the zero value is empty bytes.
8360
+ * - For bool, the zero value is false.
8361
+ * - For numeric types, the zero value is zero.
8362
+ * - For enums, the zero value is the first defined enum value.
8363
+ * - For repeated fields, the zero is an empty list.
8364
+ * - For map fields, the zero is an empty map.
8365
+ * - For message fields, absence of the message (typically a null-value) is considered zero value.
8393
8366
  *
8394
- * message Request {
8395
- * // The gt rule only applies if the field is set and it's value is not
8396
- * the default (i.e., not -42). The rule even applies if the field is set
8397
- * to zero since the default value differs.
8398
- * optional int32 value = 1 [
8399
- * default = -42,
8400
- * (buf.validate.field).int32.gt = 0,
8401
- * (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
8402
- * ];
8403
- * }
8367
+ * For fields that track presence (e.g. adding the `optional` label in proto3),
8368
+ * this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`.
8404
8369
  *
8405
- * @generated from enum value: IGNORE_IF_DEFAULT_VALUE = 2;
8370
+ * @generated from enum value: IGNORE_IF_ZERO_VALUE = 1;
8406
8371
  */
8407
- IF_DEFAULT_VALUE = 2,
8372
+ IF_ZERO_VALUE = 1,
8408
8373
  /**
8409
- * The validation rules of this field will be skipped and not evaluated. This
8410
- * is useful for situations that necessitate turning off the rules of a field
8411
- * containing a message that may not make sense in the current context, or to
8412
- * temporarily disable rules during development.
8374
+ * Always ignore rules, including the `required` rule.
8375
+ *
8376
+ * This is useful for ignoring the rules of a referenced message, or to
8377
+ * temporarily ignore rules during development.
8413
8378
  *
8414
8379
  * ```proto
8415
8380
  * message MyMessage {
8416
- * // The field's rules will always be ignored, including any validation's
8381
+ * // The field's rules will always be ignored, including any validations
8417
8382
  * // on value's fields.
8418
8383
  * MyOtherMessage value = 1 [
8419
8384
  * (buf.validate.field).ignore = IGNORE_ALWAYS];
@@ -8425,12 +8390,12 @@ export declare enum Ignore {
8425
8390
  ALWAYS = 3
8426
8391
  }
8427
8392
  /**
8428
- * Specifies how FieldRules.ignore behaves. See the documentation for
8429
- * FieldRules.required for definitions of "populated" and "nullable".
8393
+ * Specifies how `FieldRules.ignore` behaves, depending on the field's value, and
8394
+ * whether the field tracks presence.
8430
8395
  *
8431
8396
  * @generated from enum buf.validate.Ignore
8432
8397
  */
8433
- export type IgnoreJson = "IGNORE_UNSPECIFIED" | "IGNORE_IF_UNPOPULATED" | "IGNORE_IF_DEFAULT_VALUE" | "IGNORE_ALWAYS";
8398
+ export type IgnoreJson = "IGNORE_UNSPECIFIED" | "IGNORE_IF_ZERO_VALUE" | "IGNORE_ALWAYS";
8434
8399
  /**
8435
8400
  * Describes the enum buf.validate.Ignore.
8436
8401
  */