@mochabug/adaptkit 1.0.0-rc.16 → 1.0.0-rc.18
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.
- package/bin/genproto/buf/validate/validate_pb.d.ts +198 -220
- package/bin/genproto/buf/validate/validate_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/graph/exchange_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/graph/receiver_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts +4 -5
- package/bin/genproto/mochabugapis/adapt/graph/signal_binding_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts +4 -2
- package/bin/genproto/mochabugapis/adapt/graph/signal_descriptor_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/graph/transceiver_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/graph/transmitter_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/plugins/v1/manifest_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts +4 -28
- package/bin/genproto/mochabugapis/adapt/plugins/v1/oauth2_service_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/plugins/v1/service_binding_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/plugins/v1/service_definition_pb.d.ts.map +1 -1
- package/bin/genproto/mochabugapis/adapt/plugins/v1/vertex_pb.d.ts.map +1 -1
- package/bin/index.js +96 -31
- package/bin/index.js.map +3 -3
- package/package.json +14 -14
|
@@ -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
|
|
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
|
|
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
|
|
332
|
-
* validation error is returned if no fields in the oneof are
|
|
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
|
|
362
|
-
* validation error is returned if no fields in the oneof are
|
|
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,76 @@ export type FieldRules = Message<"buf.validate.FieldRules"> & {
|
|
|
414
384
|
*/
|
|
415
385
|
cel: Rule[];
|
|
416
386
|
/**
|
|
417
|
-
* If `required` is true, the field must be
|
|
418
|
-
*
|
|
387
|
+
* If `required` is true, the field must be set. A validation error is returned
|
|
388
|
+
* if the field is not set.
|
|
419
389
|
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
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.
|
|
412
|
+
*
|
|
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`. It
|
|
415
|
+
* can be added to indicate that the field cannot be the zero value.
|
|
428
416
|
*
|
|
429
417
|
* ```proto
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
418
|
+
* syntax="proto3";
|
|
419
|
+
*
|
|
420
|
+
* message FieldsWithoutPresence {
|
|
421
|
+
* // `string.email` always applies, even to an empty string.
|
|
422
|
+
* string link = 1 [
|
|
423
|
+
* (buf.validate.field).string.email = true
|
|
424
|
+
* ];
|
|
425
|
+
* // `repeated.min_items` always applies, even to an empty list.
|
|
426
|
+
* repeated string labels = 2 [
|
|
427
|
+
* (buf.validate.field).repeated.min_items = 1
|
|
428
|
+
* ];
|
|
429
|
+
* // `required`, for fields that don't track presence, indicates
|
|
430
|
+
* // the value of the field can't be the zero value.
|
|
431
|
+
* int32 zero_value_not_allowed = 3 [
|
|
432
|
+
* (buf.validate.field).required = true
|
|
433
|
+
* ];
|
|
433
434
|
* }
|
|
434
435
|
* ```
|
|
435
436
|
*
|
|
437
|
+
* To learn which fields track presence, see the
|
|
438
|
+
* [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
|
|
439
|
+
*
|
|
440
|
+
* Note: While field rules can be applied to repeated items, map keys, and map
|
|
441
|
+
* values, the elements are always considered to be set. Consequently,
|
|
442
|
+
* specifying `repeated.items.required` is redundant.
|
|
443
|
+
*
|
|
436
444
|
* @generated from field: optional bool required = 25;
|
|
437
445
|
*/
|
|
438
446
|
required: boolean;
|
|
439
447
|
/**
|
|
440
|
-
*
|
|
441
|
-
* See Ignore enum for details.
|
|
448
|
+
* Ignore validation rules on the field if its value matches the specified
|
|
449
|
+
* criteria. See the `Ignore` enum for details.
|
|
442
450
|
*
|
|
443
451
|
* ```proto
|
|
444
452
|
* message UpdateRequest {
|
|
445
|
-
* // The uri rule only applies if the field is
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
* (buf.validate.field).
|
|
449
|
-
* (buf.validate.field).string.uri = true,
|
|
453
|
+
* // The uri rule only applies if the field is not an empty string.
|
|
454
|
+
* string url = 1 [
|
|
455
|
+
* (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE,
|
|
456
|
+
* (buf.validate.field).string.uri = true
|
|
450
457
|
* ];
|
|
451
458
|
* }
|
|
452
459
|
* ```
|
|
@@ -621,39 +628,76 @@ export type FieldRulesJson = {
|
|
|
621
628
|
*/
|
|
622
629
|
cel?: RuleJson[];
|
|
623
630
|
/**
|
|
624
|
-
* If `required` is true, the field must be
|
|
625
|
-
*
|
|
631
|
+
* If `required` is true, the field must be set. A validation error is returned
|
|
632
|
+
* if the field is not set.
|
|
633
|
+
*
|
|
634
|
+
* ```proto
|
|
635
|
+
* syntax="proto3";
|
|
636
|
+
*
|
|
637
|
+
* message FieldsWithPresence {
|
|
638
|
+
* // Requires any string to be set, including the empty string.
|
|
639
|
+
* optional string link = 1 [
|
|
640
|
+
* (buf.validate.field).required = true
|
|
641
|
+
* ];
|
|
642
|
+
* // Requires true or false to be set.
|
|
643
|
+
* optional bool disabled = 2 [
|
|
644
|
+
* (buf.validate.field).required = true
|
|
645
|
+
* ];
|
|
646
|
+
* // Requires a message to be set, including the empty message.
|
|
647
|
+
* SomeMessage msg = 4 [
|
|
648
|
+
* (buf.validate.field).required = true
|
|
649
|
+
* ];
|
|
650
|
+
* }
|
|
651
|
+
* ```
|
|
626
652
|
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
* - map keys/values and repeated items are always considered populated
|
|
653
|
+
* All fields in the example above track presence. By default, Protovalidate
|
|
654
|
+
* ignores rules on those fields if no value is set. `required` ensures that
|
|
655
|
+
* the fields are set and valid.
|
|
656
|
+
*
|
|
657
|
+
* Fields that don't track presence are always validated by Protovalidate,
|
|
658
|
+
* whether they are set or not. It is not necessary to add `required`. It
|
|
659
|
+
* can be added to indicate that the field cannot be the zero value.
|
|
635
660
|
*
|
|
636
661
|
* ```proto
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
662
|
+
* syntax="proto3";
|
|
663
|
+
*
|
|
664
|
+
* message FieldsWithoutPresence {
|
|
665
|
+
* // `string.email` always applies, even to an empty string.
|
|
666
|
+
* string link = 1 [
|
|
667
|
+
* (buf.validate.field).string.email = true
|
|
668
|
+
* ];
|
|
669
|
+
* // `repeated.min_items` always applies, even to an empty list.
|
|
670
|
+
* repeated string labels = 2 [
|
|
671
|
+
* (buf.validate.field).repeated.min_items = 1
|
|
672
|
+
* ];
|
|
673
|
+
* // `required`, for fields that don't track presence, indicates
|
|
674
|
+
* // the value of the field can't be the zero value.
|
|
675
|
+
* int32 zero_value_not_allowed = 3 [
|
|
676
|
+
* (buf.validate.field).required = true
|
|
677
|
+
* ];
|
|
640
678
|
* }
|
|
641
679
|
* ```
|
|
642
680
|
*
|
|
681
|
+
* To learn which fields track presence, see the
|
|
682
|
+
* [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
|
|
683
|
+
*
|
|
684
|
+
* Note: While field rules can be applied to repeated items, map keys, and map
|
|
685
|
+
* values, the elements are always considered to be set. Consequently,
|
|
686
|
+
* specifying `repeated.items.required` is redundant.
|
|
687
|
+
*
|
|
643
688
|
* @generated from field: optional bool required = 25;
|
|
644
689
|
*/
|
|
645
690
|
required?: boolean;
|
|
646
691
|
/**
|
|
647
|
-
*
|
|
648
|
-
* See Ignore enum for details.
|
|
692
|
+
* Ignore validation rules on the field if its value matches the specified
|
|
693
|
+
* criteria. See the `Ignore` enum for details.
|
|
649
694
|
*
|
|
650
695
|
* ```proto
|
|
651
696
|
* message UpdateRequest {
|
|
652
|
-
* // The uri rule only applies if the field is
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
* (buf.validate.field).
|
|
656
|
-
* (buf.validate.field).string.uri = true,
|
|
697
|
+
* // The uri rule only applies if the field is not an empty string.
|
|
698
|
+
* string url = 1 [
|
|
699
|
+
* (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE,
|
|
700
|
+
* (buf.validate.field).string.uri = true
|
|
657
701
|
* ];
|
|
658
702
|
* }
|
|
659
703
|
* ```
|
|
@@ -6728,10 +6772,7 @@ export type RepeatedRules = Message<"buf.validate.RepeatedRules"> & {
|
|
|
6728
6772
|
/**
|
|
6729
6773
|
* `items` details the rules to be applied to each item
|
|
6730
6774
|
* in the field. Even for repeated message fields, validation is executed
|
|
6731
|
-
* against each item unless
|
|
6732
|
-
*
|
|
6733
|
-
* Note that repeated items are always considered populated. The `required`
|
|
6734
|
-
* rule does not apply.
|
|
6775
|
+
* against each item unless `ignore` is specified.
|
|
6735
6776
|
*
|
|
6736
6777
|
* ```proto
|
|
6737
6778
|
* message MyRepeated {
|
|
@@ -6745,6 +6786,9 @@ export type RepeatedRules = Message<"buf.validate.RepeatedRules"> & {
|
|
|
6745
6786
|
* }
|
|
6746
6787
|
* ```
|
|
6747
6788
|
*
|
|
6789
|
+
* Note that the `required` rule does not apply. Repeated items
|
|
6790
|
+
* cannot be unset.
|
|
6791
|
+
*
|
|
6748
6792
|
* @generated from field: optional buf.validate.FieldRules items = 4;
|
|
6749
6793
|
*/
|
|
6750
6794
|
items?: FieldRules;
|
|
@@ -6805,10 +6849,7 @@ export type RepeatedRulesJson = {
|
|
|
6805
6849
|
/**
|
|
6806
6850
|
* `items` details the rules to be applied to each item
|
|
6807
6851
|
* in the field. Even for repeated message fields, validation is executed
|
|
6808
|
-
* against each item unless
|
|
6809
|
-
*
|
|
6810
|
-
* Note that repeated items are always considered populated. The `required`
|
|
6811
|
-
* rule does not apply.
|
|
6852
|
+
* against each item unless `ignore` is specified.
|
|
6812
6853
|
*
|
|
6813
6854
|
* ```proto
|
|
6814
6855
|
* message MyRepeated {
|
|
@@ -6822,6 +6863,9 @@ export type RepeatedRulesJson = {
|
|
|
6822
6863
|
* }
|
|
6823
6864
|
* ```
|
|
6824
6865
|
*
|
|
6866
|
+
* Note that the `required` rule does not apply. Repeated items
|
|
6867
|
+
* cannot be unset.
|
|
6868
|
+
*
|
|
6825
6869
|
* @generated from field: optional buf.validate.FieldRules items = 4;
|
|
6826
6870
|
*/
|
|
6827
6871
|
items?: FieldRulesJson;
|
|
@@ -6870,9 +6914,6 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
|
|
|
6870
6914
|
/**
|
|
6871
6915
|
* Specifies the rules to be applied to each key in the field.
|
|
6872
6916
|
*
|
|
6873
|
-
* Note that map keys are always considered populated. The `required`
|
|
6874
|
-
* rule does not apply.
|
|
6875
|
-
*
|
|
6876
6917
|
* ```proto
|
|
6877
6918
|
* message MyMap {
|
|
6878
6919
|
* // The keys in the field `value` must follow the specified rules.
|
|
@@ -6885,16 +6926,15 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
|
|
|
6885
6926
|
* }
|
|
6886
6927
|
* ```
|
|
6887
6928
|
*
|
|
6929
|
+
* Note that the `required` rule does not apply. Map keys cannot be unset.
|
|
6930
|
+
*
|
|
6888
6931
|
* @generated from field: optional buf.validate.FieldRules keys = 4;
|
|
6889
6932
|
*/
|
|
6890
6933
|
keys?: FieldRules;
|
|
6891
6934
|
/**
|
|
6892
6935
|
* Specifies the rules to be applied to the value of each key in the
|
|
6893
6936
|
* field. Message values will still have their validations evaluated unless
|
|
6894
|
-
*
|
|
6895
|
-
*
|
|
6896
|
-
* Note that map values are always considered populated. The `required`
|
|
6897
|
-
* rule does not apply.
|
|
6937
|
+
* `ignore` is specified.
|
|
6898
6938
|
*
|
|
6899
6939
|
* ```proto
|
|
6900
6940
|
* message MyMap {
|
|
@@ -6907,6 +6947,7 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
|
|
|
6907
6947
|
* }];
|
|
6908
6948
|
* }
|
|
6909
6949
|
* ```
|
|
6950
|
+
* Note that the `required` rule does not apply. Map values cannot be unset.
|
|
6910
6951
|
*
|
|
6911
6952
|
* @generated from field: optional buf.validate.FieldRules values = 5;
|
|
6912
6953
|
*/
|
|
@@ -6949,9 +6990,6 @@ export type MapRulesJson = {
|
|
|
6949
6990
|
/**
|
|
6950
6991
|
* Specifies the rules to be applied to each key in the field.
|
|
6951
6992
|
*
|
|
6952
|
-
* Note that map keys are always considered populated. The `required`
|
|
6953
|
-
* rule does not apply.
|
|
6954
|
-
*
|
|
6955
6993
|
* ```proto
|
|
6956
6994
|
* message MyMap {
|
|
6957
6995
|
* // The keys in the field `value` must follow the specified rules.
|
|
@@ -6964,16 +7002,15 @@ export type MapRulesJson = {
|
|
|
6964
7002
|
* }
|
|
6965
7003
|
* ```
|
|
6966
7004
|
*
|
|
7005
|
+
* Note that the `required` rule does not apply. Map keys cannot be unset.
|
|
7006
|
+
*
|
|
6967
7007
|
* @generated from field: optional buf.validate.FieldRules keys = 4;
|
|
6968
7008
|
*/
|
|
6969
7009
|
keys?: FieldRulesJson;
|
|
6970
7010
|
/**
|
|
6971
7011
|
* Specifies the rules to be applied to the value of each key in the
|
|
6972
7012
|
* field. Message values will still have their validations evaluated unless
|
|
6973
|
-
*
|
|
6974
|
-
*
|
|
6975
|
-
* Note that map values are always considered populated. The `required`
|
|
6976
|
-
* rule does not apply.
|
|
7013
|
+
* `ignore` is specified.
|
|
6977
7014
|
*
|
|
6978
7015
|
* ```proto
|
|
6979
7016
|
* message MyMap {
|
|
@@ -6986,6 +7023,7 @@ export type MapRulesJson = {
|
|
|
6986
7023
|
* }];
|
|
6987
7024
|
* }
|
|
6988
7025
|
* ```
|
|
7026
|
+
* Note that the `required` rule does not apply. Map values cannot be unset.
|
|
6989
7027
|
*
|
|
6990
7028
|
* @generated from field: optional buf.validate.FieldRules values = 5;
|
|
6991
7029
|
*/
|
|
@@ -8263,160 +8301,100 @@ export declare const FieldPathElementSchema: GenMessage<FieldPathElement, {
|
|
|
8263
8301
|
jsonType: FieldPathElementJson;
|
|
8264
8302
|
}>;
|
|
8265
8303
|
/**
|
|
8266
|
-
* Specifies how FieldRules.ignore behaves
|
|
8267
|
-
*
|
|
8304
|
+
* Specifies how `FieldRules.ignore` behaves, depending on the field's value, and
|
|
8305
|
+
* whether the field tracks presence.
|
|
8268
8306
|
*
|
|
8269
8307
|
* @generated from enum buf.validate.Ignore
|
|
8270
8308
|
*/
|
|
8271
8309
|
export declare enum Ignore {
|
|
8272
8310
|
/**
|
|
8273
|
-
*
|
|
8311
|
+
* Ignore rules if the field tracks presence and is unset. This is the default
|
|
8312
|
+
* behavior.
|
|
8313
|
+
*
|
|
8314
|
+
* In proto3, only message fields, members of a Protobuf `oneof`, and fields
|
|
8315
|
+
* with the `optional` label track presence. Consequently, the following fields
|
|
8316
|
+
* are always validated, whether a value is set or not:
|
|
8274
8317
|
*
|
|
8275
8318
|
* ```proto
|
|
8276
8319
|
* syntax="proto3";
|
|
8277
8320
|
*
|
|
8278
|
-
* message
|
|
8279
|
-
*
|
|
8280
|
-
*
|
|
8281
|
-
* (buf.validate.field).string.uri = true
|
|
8321
|
+
* message RulesApply {
|
|
8322
|
+
* string email = 1 [
|
|
8323
|
+
* (buf.validate.field).string.email = true
|
|
8282
8324
|
* ];
|
|
8283
|
-
*
|
|
8284
|
-
*
|
|
8285
|
-
* // set to the empty string.
|
|
8286
|
-
* optional string bar = 2 [
|
|
8287
|
-
* (buf.validate.field).string.uri = true
|
|
8325
|
+
* int32 age = 2 [
|
|
8326
|
+
* (buf.validate.field).int32.gt = 0
|
|
8288
8327
|
* ];
|
|
8289
|
-
*
|
|
8290
|
-
*
|
|
8291
|
-
* repeated string baz = 3 [
|
|
8292
|
-
* (buf.validate.field).repeated.min_items = 3
|
|
8293
|
-
* ];
|
|
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 = {/* ... *\/}
|
|
8328
|
+
* repeated string labels = 3 [
|
|
8329
|
+
* (buf.validate.field).repeated.min_items = 1
|
|
8299
8330
|
* ];
|
|
8300
8331
|
* }
|
|
8301
8332
|
* ```
|
|
8302
8333
|
*
|
|
8303
|
-
*
|
|
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.
|
|
8334
|
+
* In contrast, the following fields track presence, and are only validated if
|
|
8335
|
+
* a value is set:
|
|
8309
8336
|
*
|
|
8310
8337
|
* ```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
|
-
* ];
|
|
8338
|
+
* syntax="proto3";
|
|
8327
8339
|
*
|
|
8328
|
-
*
|
|
8329
|
-
*
|
|
8330
|
-
* (buf.validate.field).
|
|
8331
|
-
* (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
|
|
8340
|
+
* message RulesApplyIfSet {
|
|
8341
|
+
* optional string email = 1 [
|
|
8342
|
+
* (buf.validate.field).string.email = true
|
|
8332
8343
|
* ];
|
|
8333
|
-
*
|
|
8334
|
-
*
|
|
8335
|
-
*
|
|
8336
|
-
*
|
|
8337
|
-
*
|
|
8338
|
-
*
|
|
8339
|
-
*
|
|
8344
|
+
* oneof ref {
|
|
8345
|
+
* string reference = 2 [
|
|
8346
|
+
* (buf.validate.field).string.uuid = true
|
|
8347
|
+
* ];
|
|
8348
|
+
* string name = 3 [
|
|
8349
|
+
* (buf.validate.field).string.min_len = 4
|
|
8350
|
+
* ];
|
|
8351
|
+
* }
|
|
8352
|
+
* SomeMessage msg = 4 [
|
|
8353
|
+
* (buf.validate.field).cel = {/* ... *\/}
|
|
8340
8354
|
* ];
|
|
8341
8355
|
* }
|
|
8342
8356
|
* ```
|
|
8343
8357
|
*
|
|
8344
|
-
*
|
|
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.
|
|
8352
|
-
*
|
|
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
|
-
* ];
|
|
8358
|
+
* To ensure that such a field is set, add the `required` rule.
|
|
8379
8359
|
*
|
|
8380
|
-
*
|
|
8381
|
-
*
|
|
8382
|
-
* SomeMessage quux = 4 [
|
|
8383
|
-
* (buf.validate.field).cel = {/* ... *\/},
|
|
8384
|
-
* (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
|
|
8385
|
-
* ];
|
|
8386
|
-
* }
|
|
8387
|
-
* ```
|
|
8360
|
+
* To learn which fields track presence, see the
|
|
8361
|
+
* [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
|
|
8388
8362
|
*
|
|
8389
|
-
*
|
|
8363
|
+
* @generated from enum value: IGNORE_UNSPECIFIED = 0;
|
|
8364
|
+
*/
|
|
8365
|
+
UNSPECIFIED = 0,
|
|
8366
|
+
/**
|
|
8367
|
+
* Ignore rules if the field is unset, or set to the zero value.
|
|
8390
8368
|
*
|
|
8391
|
-
*
|
|
8392
|
-
*
|
|
8369
|
+
* The zero value depends on the field type:
|
|
8370
|
+
* - For strings, the zero value is the empty string.
|
|
8371
|
+
* - For bytes, the zero value is empty bytes.
|
|
8372
|
+
* - For bool, the zero value is false.
|
|
8373
|
+
* - For numeric types, the zero value is zero.
|
|
8374
|
+
* - For enums, the zero value is the first defined enum value.
|
|
8375
|
+
* - For repeated fields, the zero is an empty list.
|
|
8376
|
+
* - For map fields, the zero is an empty map.
|
|
8377
|
+
* - For message fields, absence of the message (typically a null-value) is considered zero value.
|
|
8393
8378
|
*
|
|
8394
|
-
*
|
|
8395
|
-
*
|
|
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
|
-
* }
|
|
8379
|
+
* For fields that track presence (e.g. adding the `optional` label in proto3),
|
|
8380
|
+
* this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`.
|
|
8404
8381
|
*
|
|
8405
|
-
* @generated from enum value:
|
|
8382
|
+
* @generated from enum value: IGNORE_IF_ZERO_VALUE = 1;
|
|
8406
8383
|
*/
|
|
8407
|
-
|
|
8384
|
+
IF_ZERO_VALUE = 1,
|
|
8408
8385
|
/**
|
|
8409
|
-
*
|
|
8410
|
-
*
|
|
8411
|
-
*
|
|
8412
|
-
* temporarily
|
|
8386
|
+
* Always ignore rules, including the `required` rule.
|
|
8387
|
+
*
|
|
8388
|
+
* This is useful for ignoring the rules of a referenced message, or to
|
|
8389
|
+
* temporarily ignore rules during development.
|
|
8413
8390
|
*
|
|
8414
8391
|
* ```proto
|
|
8415
8392
|
* message MyMessage {
|
|
8416
|
-
* // The field's rules will always be ignored, including any
|
|
8393
|
+
* // The field's rules will always be ignored, including any validations
|
|
8417
8394
|
* // on value's fields.
|
|
8418
8395
|
* MyOtherMessage value = 1 [
|
|
8419
|
-
* (buf.validate.field).ignore = IGNORE_ALWAYS
|
|
8396
|
+
* (buf.validate.field).ignore = IGNORE_ALWAYS
|
|
8397
|
+
* ];
|
|
8420
8398
|
* }
|
|
8421
8399
|
* ```
|
|
8422
8400
|
*
|
|
@@ -8425,12 +8403,12 @@ export declare enum Ignore {
|
|
|
8425
8403
|
ALWAYS = 3
|
|
8426
8404
|
}
|
|
8427
8405
|
/**
|
|
8428
|
-
* Specifies how FieldRules.ignore behaves
|
|
8429
|
-
*
|
|
8406
|
+
* Specifies how `FieldRules.ignore` behaves, depending on the field's value, and
|
|
8407
|
+
* whether the field tracks presence.
|
|
8430
8408
|
*
|
|
8431
8409
|
* @generated from enum buf.validate.Ignore
|
|
8432
8410
|
*/
|
|
8433
|
-
export type IgnoreJson = "IGNORE_UNSPECIFIED" | "
|
|
8411
|
+
export type IgnoreJson = "IGNORE_UNSPECIFIED" | "IGNORE_IF_ZERO_VALUE" | "IGNORE_ALWAYS";
|
|
8434
8412
|
/**
|
|
8435
8413
|
* Describes the enum buf.validate.Ignore.
|
|
8436
8414
|
*/
|