@opentdf/sdk 0.4.0-beta.38 → 0.4.0-beta.39
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/dist/cjs/src/platform/authorization/v2/authorization_pb.js +112 -0
- package/dist/cjs/src/platform/buf/validate/validate_pb.js +114 -170
- package/dist/cjs/src/platform/common/common_pb.js +16 -5
- package/dist/cjs/src/platform/entity/entity_pb.js +51 -0
- package/dist/cjs/src/platform/entityresolution/v2/entity_resolution_pb.js +49 -0
- package/dist/cjs/src/platform/google/api/annotations_pb.js +1 -1
- package/dist/cjs/src/platform/google/api/http_pb.js +3 -3
- package/dist/cjs/src/platform/kas/kas_pb.js +2 -2
- package/dist/cjs/src/platform/policy/attributes/attributes_pb.js +12 -2
- package/dist/cjs/src/platform/policy/kasregistry/key_access_server_registry_pb.js +26 -4
- package/dist/cjs/src/platform/policy/keymanagement/key_management_pb.js +2 -2
- package/dist/cjs/src/platform/policy/namespaces/namespaces_pb.js +31 -3
- package/dist/cjs/src/platform/policy/objects_pb.js +59 -28
- package/dist/cjs/src/platform/policy/obligations/obligations_pb.js +159 -0
- package/dist/cjs/src/platform/policy/selectors_pb.js +1 -1
- package/dist/cjs/src/platform/policy/unsafe/unsafe_pb.js +2 -2
- package/dist/cjs/src/policy/api.js +1 -7
- package/dist/types/src/platform/authorization/v2/authorization_pb.d.ts +439 -0
- package/dist/types/src/platform/authorization/v2/authorization_pb.d.ts.map +1 -0
- package/dist/types/src/platform/buf/validate/validate_pb.d.ts +495 -370
- package/dist/types/src/platform/buf/validate/validate_pb.d.ts.map +1 -1
- package/dist/types/src/platform/common/common_pb.d.ts +36 -0
- package/dist/types/src/platform/common/common_pb.d.ts.map +1 -1
- package/dist/types/src/platform/entity/entity_pb.d.ts +130 -0
- package/dist/types/src/platform/entity/entity_pb.d.ts.map +1 -0
- package/dist/types/src/platform/entityresolution/v2/entity_resolution_pb.d.ts +136 -0
- package/dist/types/src/platform/entityresolution/v2/entity_resolution_pb.d.ts.map +1 -0
- package/dist/types/src/platform/google/api/http_pb.d.ts.map +1 -1
- package/dist/types/src/platform/kas/kas_pb.d.ts +5 -0
- package/dist/types/src/platform/kas/kas_pb.d.ts.map +1 -1
- package/dist/types/src/platform/policy/attributes/attributes_pb.d.ts +44 -13
- package/dist/types/src/platform/policy/attributes/attributes_pb.d.ts.map +1 -1
- package/dist/types/src/platform/policy/kasregistry/key_access_server_registry_pb.d.ts +148 -0
- package/dist/types/src/platform/policy/kasregistry/key_access_server_registry_pb.d.ts.map +1 -1
- package/dist/types/src/platform/policy/keymanagement/key_management_pb.d.ts +20 -1
- package/dist/types/src/platform/policy/keymanagement/key_management_pb.d.ts.map +1 -1
- package/dist/types/src/platform/policy/namespaces/namespaces_pb.d.ts +143 -5
- package/dist/types/src/platform/policy/namespaces/namespaces_pb.d.ts.map +1 -1
- package/dist/types/src/platform/policy/objects_pb.d.ts +187 -6
- package/dist/types/src/platform/policy/objects_pb.d.ts.map +1 -1
- package/dist/types/src/platform/policy/obligations/obligations_pb.d.ts +670 -0
- package/dist/types/src/platform/policy/obligations/obligations_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/selectors_pb.d.ts +18 -0
- package/dist/types/src/platform/policy/selectors_pb.d.ts.map +1 -1
- package/dist/types/src/platform/policy/unsafe/unsafe_pb.d.ts +18 -3
- package/dist/types/src/platform/policy/unsafe/unsafe_pb.d.ts.map +1 -1
- package/dist/types/src/policy/api.d.ts.map +1 -1
- package/dist/web/src/platform/authorization/v2/authorization_pb.js +109 -0
- package/dist/web/src/platform/buf/validate/validate_pb.js +113 -169
- package/dist/web/src/platform/common/common_pb.js +15 -4
- package/dist/web/src/platform/entity/entity_pb.js +48 -0
- package/dist/web/src/platform/entityresolution/v2/entity_resolution_pb.js +46 -0
- package/dist/web/src/platform/google/api/annotations_pb.js +1 -1
- package/dist/web/src/platform/google/api/http_pb.js +3 -3
- package/dist/web/src/platform/kas/kas_pb.js +2 -2
- package/dist/web/src/platform/policy/attributes/attributes_pb.js +12 -2
- package/dist/web/src/platform/policy/kasregistry/key_access_server_registry_pb.js +25 -3
- package/dist/web/src/platform/policy/keymanagement/key_management_pb.js +2 -2
- package/dist/web/src/platform/policy/namespaces/namespaces_pb.js +30 -2
- package/dist/web/src/platform/policy/objects_pb.js +57 -27
- package/dist/web/src/platform/policy/obligations/obligations_pb.js +156 -0
- package/dist/web/src/platform/policy/selectors_pb.js +1 -1
- package/dist/web/src/platform/policy/unsafe/unsafe_pb.js +2 -2
- package/dist/web/src/policy/api.js +1 -7
- package/package.json +3 -3
- package/src/platform/authorization/v2/authorization_pb.ts +503 -0
- package/src/platform/buf/validate/validate_pb.ts +529 -401
- package/src/platform/common/common_pb.ts +48 -3
- package/src/platform/entity/entity_pb.ts +154 -0
- package/src/platform/entityresolution/v2/entity_resolution_pb.ts +170 -0
- package/src/platform/google/api/annotations_pb.ts +1 -1
- package/src/platform/google/api/http_pb.ts +2 -2
- package/src/platform/kas/kas_pb.ts +6 -1
- package/src/platform/policy/attributes/attributes_pb.ts +46 -16
- package/src/platform/policy/kasregistry/key_access_server_registry_pb.ts +168 -2
- package/src/platform/policy/keymanagement/key_management_pb.ts +24 -2
- package/src/platform/policy/namespaces/namespaces_pb.ts +163 -6
- package/src/platform/policy/objects_pb.ts +252 -32
- package/src/platform/policy/obligations/obligations_pb.ts +788 -0
- package/src/platform/policy/selectors_pb.ts +18 -0
- package/src/platform/policy/unsafe/unsafe_pb.ts +21 -4
- package/src/policy/api.ts +0 -6
|
@@ -6,10 +6,10 @@ import type { Message } from "@bufbuild/protobuf";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const file_buf_validate_validate: GenFile;
|
|
8
8
|
/**
|
|
9
|
-
* `
|
|
10
|
-
* Language (CEL) syntax. Each
|
|
9
|
+
* `Rule` represents a validation rule written in the Common Expression
|
|
10
|
+
* Language (CEL) syntax. Each Rule includes a unique identifier, an
|
|
11
11
|
* optional error message, and the CEL expression to evaluate. For more
|
|
12
|
-
* information
|
|
12
|
+
* information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
|
|
13
13
|
*
|
|
14
14
|
* ```proto
|
|
15
15
|
* message Foo {
|
|
@@ -22,11 +22,11 @@ export declare const file_buf_validate_validate: GenFile;
|
|
|
22
22
|
* }
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
* @generated from message buf.validate.
|
|
25
|
+
* @generated from message buf.validate.Rule
|
|
26
26
|
*/
|
|
27
|
-
export type
|
|
27
|
+
export type Rule = Message<"buf.validate.Rule"> & {
|
|
28
28
|
/**
|
|
29
|
-
* `id` is a string that serves as a machine-readable name for this
|
|
29
|
+
* `id` is a string that serves as a machine-readable name for this Rule.
|
|
30
30
|
* It should be unique within its scope, which could be either a message or a field.
|
|
31
31
|
*
|
|
32
32
|
* @generated from field: optional string id = 1;
|
|
@@ -34,7 +34,7 @@ export type Constraint = Message<"buf.validate.Constraint"> & {
|
|
|
34
34
|
id: string;
|
|
35
35
|
/**
|
|
36
36
|
* `message` is an optional field that provides a human-readable error message
|
|
37
|
-
* for this
|
|
37
|
+
* for this Rule when the CEL expression evaluates to false. If a
|
|
38
38
|
* non-empty message is provided, any strings resulting from the CEL
|
|
39
39
|
* expression evaluation are ignored.
|
|
40
40
|
*
|
|
@@ -52,69 +52,117 @@ export type Constraint = Message<"buf.validate.Constraint"> & {
|
|
|
52
52
|
expression: string;
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
|
-
* Describes the message buf.validate.
|
|
56
|
-
* Use `create(
|
|
55
|
+
* Describes the message buf.validate.Rule.
|
|
56
|
+
* Use `create(RuleSchema)` to create a new message.
|
|
57
57
|
*/
|
|
58
|
-
export declare const
|
|
58
|
+
export declare const RuleSchema: GenMessage<Rule>;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
* It includes disabling options and a list of
|
|
60
|
+
* MessageRules represents validation rules that are applied to the entire message.
|
|
61
|
+
* It includes disabling options and a list of Rule messages representing Common Expression Language (CEL) validation rules.
|
|
62
62
|
*
|
|
63
|
-
* @generated from message buf.validate.
|
|
63
|
+
* @generated from message buf.validate.MessageRules
|
|
64
64
|
*/
|
|
65
|
-
export type
|
|
65
|
+
export type MessageRules = Message<"buf.validate.MessageRules"> & {
|
|
66
66
|
/**
|
|
67
|
-
* `
|
|
68
|
-
*
|
|
67
|
+
* `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message.
|
|
68
|
+
* These rules are written in Common Expression Language (CEL) syntax. For more information,
|
|
69
|
+
* [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
|
|
70
|
+
*
|
|
69
71
|
*
|
|
70
72
|
* ```proto
|
|
71
73
|
* message MyMessage {
|
|
72
|
-
* //
|
|
73
|
-
* option (buf.validate.message).
|
|
74
|
+
* // The field `foo` must be greater than 42.
|
|
75
|
+
* option (buf.validate.message).cel = {
|
|
76
|
+
* id: "my_message.value",
|
|
77
|
+
* message: "value must be greater than 42",
|
|
78
|
+
* expression: "this.foo > 42",
|
|
79
|
+
* };
|
|
80
|
+
* optional int32 foo = 1;
|
|
74
81
|
* }
|
|
75
82
|
* ```
|
|
76
83
|
*
|
|
77
|
-
* @generated from field:
|
|
84
|
+
* @generated from field: repeated buf.validate.Rule cel = 3;
|
|
78
85
|
*/
|
|
79
|
-
|
|
86
|
+
cel: Rule[];
|
|
80
87
|
/**
|
|
81
|
-
* `
|
|
82
|
-
*
|
|
83
|
-
*
|
|
88
|
+
* `oneof` is a repeated field of type MessageOneofRule that specifies a list of fields
|
|
89
|
+
* of which at most one can be present. If `required` is also specified, then exactly one
|
|
90
|
+
* of the specified fields _must_ be present.
|
|
91
|
+
*
|
|
92
|
+
* This will enforce oneof-like constraints with a few features not provided by
|
|
93
|
+
* actual Protobuf oneof declarations:
|
|
94
|
+
* 1. Repeated and map fields are allowed in this validation. In a Protobuf oneof,
|
|
95
|
+
* only scalar fields are allowed.
|
|
96
|
+
* 2. Fields with implicit presence are allowed. In a Protobuf oneof, all member
|
|
97
|
+
* fields have explicit presence. This means that, for the purpose of determining
|
|
98
|
+
* how many fields are set, explicitly setting such a field to its zero value is
|
|
99
|
+
* effectively the same as not setting it at all.
|
|
100
|
+
* 3. This will always generate validation errors for a message unmarshalled from
|
|
101
|
+
* serialized data that sets more than one field. With a Protobuf oneof, when
|
|
102
|
+
* multiple fields are present in the serialized form, earlier values are usually
|
|
103
|
+
* silently ignored when unmarshalling, with only the last field being set when
|
|
104
|
+
* unmarshalling completes.
|
|
84
105
|
*
|
|
106
|
+
* Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means
|
|
107
|
+
* only the field that is set will be validated and the unset fields are not validated according to the field rules.
|
|
108
|
+
* This behavior can be overridden by setting `ignore` against a field.
|
|
85
109
|
*
|
|
86
110
|
* ```proto
|
|
87
111
|
* message MyMessage {
|
|
88
|
-
* //
|
|
89
|
-
* option (buf.validate.message).
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
112
|
+
* // Only one of `field1` or `field2` _can_ be present in this message.
|
|
113
|
+
* option (buf.validate.message).oneof = { fields: ["field1", "field2"] };
|
|
114
|
+
* // Exactly one of `field3` or `field4` _must_ be present in this message.
|
|
115
|
+
* option (buf.validate.message).oneof = { fields: ["field3", "field4"], required: true };
|
|
116
|
+
* string field1 = 1;
|
|
117
|
+
* bytes field2 = 2;
|
|
118
|
+
* bool field3 = 3;
|
|
119
|
+
* int32 field4 = 4;
|
|
95
120
|
* }
|
|
96
121
|
* ```
|
|
97
122
|
*
|
|
98
|
-
* @generated from field: repeated buf.validate.
|
|
123
|
+
* @generated from field: repeated buf.validate.MessageOneofRule oneof = 4;
|
|
124
|
+
*/
|
|
125
|
+
oneof: MessageOneofRule[];
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Describes the message buf.validate.MessageRules.
|
|
129
|
+
* Use `create(MessageRulesSchema)` to create a new message.
|
|
130
|
+
*/
|
|
131
|
+
export declare const MessageRulesSchema: GenMessage<MessageRules>;
|
|
132
|
+
/**
|
|
133
|
+
* @generated from message buf.validate.MessageOneofRule
|
|
134
|
+
*/
|
|
135
|
+
export type MessageOneofRule = Message<"buf.validate.MessageOneofRule"> & {
|
|
136
|
+
/**
|
|
137
|
+
* A list of field names to include in the oneof. All field names must be
|
|
138
|
+
* defined in the message. At least one field must be specified, and
|
|
139
|
+
* duplicates are not permitted.
|
|
140
|
+
*
|
|
141
|
+
* @generated from field: repeated string fields = 1;
|
|
99
142
|
*/
|
|
100
|
-
|
|
143
|
+
fields: string[];
|
|
144
|
+
/**
|
|
145
|
+
* If true, one of the fields specified _must_ be set.
|
|
146
|
+
*
|
|
147
|
+
* @generated from field: optional bool required = 2;
|
|
148
|
+
*/
|
|
149
|
+
required: boolean;
|
|
101
150
|
};
|
|
102
151
|
/**
|
|
103
|
-
* Describes the message buf.validate.
|
|
104
|
-
* Use `create(
|
|
152
|
+
* Describes the message buf.validate.MessageOneofRule.
|
|
153
|
+
* Use `create(MessageOneofRuleSchema)` to create a new message.
|
|
105
154
|
*/
|
|
106
|
-
export declare const
|
|
155
|
+
export declare const MessageOneofRuleSchema: GenMessage<MessageOneofRule>;
|
|
107
156
|
/**
|
|
108
|
-
* The `
|
|
157
|
+
* The `OneofRules` message type enables you to manage rules for
|
|
109
158
|
* oneof fields in your protobuf messages.
|
|
110
159
|
*
|
|
111
|
-
* @generated from message buf.validate.
|
|
160
|
+
* @generated from message buf.validate.OneofRules
|
|
112
161
|
*/
|
|
113
|
-
export type
|
|
162
|
+
export type OneofRules = Message<"buf.validate.OneofRules"> & {
|
|
114
163
|
/**
|
|
115
|
-
* If `required` is true, exactly one field of the oneof must be
|
|
116
|
-
* validation error is returned if no fields in the oneof are
|
|
117
|
-
* field itself may still be a default value; further constraints
|
|
164
|
+
* If `required` is true, exactly one field of the oneof must be set. A
|
|
165
|
+
* validation error is returned if no fields in the oneof are set. Further rules
|
|
118
166
|
* should be placed on the fields themselves to ensure they are valid values,
|
|
119
167
|
* such as `min_len` or `gt`.
|
|
120
168
|
*
|
|
@@ -135,21 +183,21 @@ export type OneofConstraints = Message<"buf.validate.OneofConstraints"> & {
|
|
|
135
183
|
required: boolean;
|
|
136
184
|
};
|
|
137
185
|
/**
|
|
138
|
-
* Describes the message buf.validate.
|
|
139
|
-
* Use `create(
|
|
186
|
+
* Describes the message buf.validate.OneofRules.
|
|
187
|
+
* Use `create(OneofRulesSchema)` to create a new message.
|
|
140
188
|
*/
|
|
141
|
-
export declare const
|
|
189
|
+
export declare const OneofRulesSchema: GenMessage<OneofRules>;
|
|
142
190
|
/**
|
|
143
|
-
*
|
|
191
|
+
* FieldRules encapsulates the rules for each type of field. Depending on
|
|
144
192
|
* the field, the correct set should be used to ensure proper validations.
|
|
145
193
|
*
|
|
146
|
-
* @generated from message buf.validate.
|
|
194
|
+
* @generated from message buf.validate.FieldRules
|
|
147
195
|
*/
|
|
148
|
-
export type
|
|
196
|
+
export type FieldRules = Message<"buf.validate.FieldRules"> & {
|
|
149
197
|
/**
|
|
150
198
|
* `cel` is a repeated field used to represent a textual expression
|
|
151
|
-
* in the Common Expression Language (CEL) syntax. For more information
|
|
152
|
-
*
|
|
199
|
+
* in the Common Expression Language (CEL) syntax. For more information,
|
|
200
|
+
* [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
|
|
153
201
|
*
|
|
154
202
|
* ```proto
|
|
155
203
|
* message MyMessage {
|
|
@@ -162,42 +210,74 @@ export type FieldConstraints = Message<"buf.validate.FieldConstraints"> & {
|
|
|
162
210
|
* }
|
|
163
211
|
* ```
|
|
164
212
|
*
|
|
165
|
-
* @generated from field: repeated buf.validate.
|
|
213
|
+
* @generated from field: repeated buf.validate.Rule cel = 23;
|
|
166
214
|
*/
|
|
167
|
-
cel:
|
|
215
|
+
cel: Rule[];
|
|
168
216
|
/**
|
|
169
|
-
* If `required` is true, the field must be
|
|
170
|
-
*
|
|
217
|
+
* If `required` is true, the field must be set. A validation error is returned
|
|
218
|
+
* if the field is not set.
|
|
219
|
+
*
|
|
220
|
+
* ```proto
|
|
221
|
+
* syntax="proto3";
|
|
222
|
+
*
|
|
223
|
+
* message FieldsWithPresence {
|
|
224
|
+
* // Requires any string to be set, including the empty string.
|
|
225
|
+
* optional string link = 1 [
|
|
226
|
+
* (buf.validate.field).required = true
|
|
227
|
+
* ];
|
|
228
|
+
* // Requires true or false to be set.
|
|
229
|
+
* optional bool disabled = 2 [
|
|
230
|
+
* (buf.validate.field).required = true
|
|
231
|
+
* ];
|
|
232
|
+
* // Requires a message to be set, including the empty message.
|
|
233
|
+
* SomeMessage msg = 4 [
|
|
234
|
+
* (buf.validate.field).required = true
|
|
235
|
+
* ];
|
|
236
|
+
* }
|
|
237
|
+
* ```
|
|
171
238
|
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* - repeated and map fields must be non-empty to be considered populated
|
|
239
|
+
* All fields in the example above track presence. By default, Protovalidate
|
|
240
|
+
* ignores rules on those fields if no value is set. `required` ensures that
|
|
241
|
+
* the fields are set and valid.
|
|
242
|
+
*
|
|
243
|
+
* Fields that don't track presence are always validated by Protovalidate,
|
|
244
|
+
* whether they are set or not. It is not necessary to add `required`:
|
|
179
245
|
*
|
|
180
246
|
* ```proto
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
247
|
+
* syntax="proto3";
|
|
248
|
+
*
|
|
249
|
+
* message FieldsWithoutPresence {
|
|
250
|
+
* // `string.email` always applies, even to an empty string.
|
|
251
|
+
* string link = 1 [
|
|
252
|
+
* (buf.validate.field).string.email = true
|
|
253
|
+
* ];
|
|
254
|
+
* // `repeated.min_items` always applies, even to an empty list.
|
|
255
|
+
* repeated string labels = 4 [
|
|
256
|
+
* (buf.validate.field).repeated.min_items = 1
|
|
257
|
+
* ];
|
|
184
258
|
* }
|
|
185
259
|
* ```
|
|
186
260
|
*
|
|
261
|
+
* To learn which fields track presence, see the
|
|
262
|
+
* [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
|
|
263
|
+
*
|
|
264
|
+
* Note: While field rules can be applied to repeated items, map keys, and map
|
|
265
|
+
* values, the elements are always considered to be set. Consequently,
|
|
266
|
+
* specifying `repeated.items.required` is redundant.
|
|
267
|
+
*
|
|
187
268
|
* @generated from field: optional bool required = 25;
|
|
188
269
|
*/
|
|
189
270
|
required: boolean;
|
|
190
271
|
/**
|
|
191
|
-
*
|
|
192
|
-
* See Ignore enum for details.
|
|
272
|
+
* Ignore validation rules on the field if its value matches the specified
|
|
273
|
+
* criteria. See the `Ignore` enum for details.
|
|
193
274
|
*
|
|
194
275
|
* ```proto
|
|
195
276
|
* message UpdateRequest {
|
|
196
|
-
* // The uri rule only applies if the field is
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* (buf.validate.field).
|
|
200
|
-
* (buf.validate.field).string.uri = true,
|
|
277
|
+
* // The uri rule only applies if the field is not an empty string.
|
|
278
|
+
* string url = 1 [
|
|
279
|
+
* (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE,
|
|
280
|
+
* (buf.validate.field).string.uri = true
|
|
201
281
|
* ];
|
|
202
282
|
* }
|
|
203
283
|
* ```
|
|
@@ -206,7 +286,7 @@ export type FieldConstraints = Message<"buf.validate.FieldConstraints"> & {
|
|
|
206
286
|
*/
|
|
207
287
|
ignore: Ignore;
|
|
208
288
|
/**
|
|
209
|
-
* @generated from oneof buf.validate.
|
|
289
|
+
* @generated from oneof buf.validate.FieldRules.type
|
|
210
290
|
*/
|
|
211
291
|
type: {
|
|
212
292
|
/**
|
|
@@ -346,21 +426,21 @@ export type FieldConstraints = Message<"buf.validate.FieldConstraints"> & {
|
|
|
346
426
|
};
|
|
347
427
|
};
|
|
348
428
|
/**
|
|
349
|
-
* Describes the message buf.validate.
|
|
350
|
-
* Use `create(
|
|
429
|
+
* Describes the message buf.validate.FieldRules.
|
|
430
|
+
* Use `create(FieldRulesSchema)` to create a new message.
|
|
351
431
|
*/
|
|
352
|
-
export declare const
|
|
432
|
+
export declare const FieldRulesSchema: GenMessage<FieldRules>;
|
|
353
433
|
/**
|
|
354
|
-
*
|
|
434
|
+
* PredefinedRules are custom rules that can be re-used with
|
|
355
435
|
* multiple fields.
|
|
356
436
|
*
|
|
357
|
-
* @generated from message buf.validate.
|
|
437
|
+
* @generated from message buf.validate.PredefinedRules
|
|
358
438
|
*/
|
|
359
|
-
export type
|
|
439
|
+
export type PredefinedRules = Message<"buf.validate.PredefinedRules"> & {
|
|
360
440
|
/**
|
|
361
441
|
* `cel` is a repeated field used to represent a textual expression
|
|
362
|
-
* in the Common Expression Language (CEL) syntax. For more information
|
|
363
|
-
*
|
|
442
|
+
* in the Common Expression Language (CEL) syntax. For more information,
|
|
443
|
+
* [see our documentation](https://buf.build/docs/protovalidate/schemas/predefined-rules/).
|
|
364
444
|
*
|
|
365
445
|
* ```proto
|
|
366
446
|
* message MyMessage {
|
|
@@ -373,17 +453,17 @@ export type PredefinedConstraints = Message<"buf.validate.PredefinedConstraints"
|
|
|
373
453
|
* }
|
|
374
454
|
* ```
|
|
375
455
|
*
|
|
376
|
-
* @generated from field: repeated buf.validate.
|
|
456
|
+
* @generated from field: repeated buf.validate.Rule cel = 1;
|
|
377
457
|
*/
|
|
378
|
-
cel:
|
|
458
|
+
cel: Rule[];
|
|
379
459
|
};
|
|
380
460
|
/**
|
|
381
|
-
* Describes the message buf.validate.
|
|
382
|
-
* Use `create(
|
|
461
|
+
* Describes the message buf.validate.PredefinedRules.
|
|
462
|
+
* Use `create(PredefinedRulesSchema)` to create a new message.
|
|
383
463
|
*/
|
|
384
|
-
export declare const
|
|
464
|
+
export declare const PredefinedRulesSchema: GenMessage<PredefinedRules>;
|
|
385
465
|
/**
|
|
386
|
-
* FloatRules describes the
|
|
466
|
+
* FloatRules describes the rules applied to `float` values. These
|
|
387
467
|
* rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type.
|
|
388
468
|
*
|
|
389
469
|
* @generated from message buf.validate.FloatRules
|
|
@@ -509,7 +589,7 @@ export type FloatRules = Message<"buf.validate.FloatRules"> & {
|
|
|
509
589
|
* ```proto
|
|
510
590
|
* message MyFloat {
|
|
511
591
|
* // value must be in list [1.0, 2.0, 3.0]
|
|
512
|
-
*
|
|
592
|
+
* float value = 1 [(buf.validate.field).float = { in: [1.0, 2.0, 3.0] }];
|
|
513
593
|
* }
|
|
514
594
|
* ```
|
|
515
595
|
*
|
|
@@ -524,7 +604,7 @@ export type FloatRules = Message<"buf.validate.FloatRules"> & {
|
|
|
524
604
|
* ```proto
|
|
525
605
|
* message MyFloat {
|
|
526
606
|
* // value must not be in list [1.0, 2.0, 3.0]
|
|
527
|
-
*
|
|
607
|
+
* float value = 1 [(buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] }];
|
|
528
608
|
* }
|
|
529
609
|
* ```
|
|
530
610
|
*
|
|
@@ -540,14 +620,14 @@ export type FloatRules = Message<"buf.validate.FloatRules"> & {
|
|
|
540
620
|
finite: boolean;
|
|
541
621
|
/**
|
|
542
622
|
* `example` specifies values that the field may have. These values SHOULD
|
|
543
|
-
* conform to other
|
|
623
|
+
* conform to other rules. `example` values will not impact validation
|
|
544
624
|
* but may be used as helpful guidance on how to populate the given field.
|
|
545
625
|
*
|
|
546
626
|
* ```proto
|
|
547
627
|
* message MyFloat {
|
|
548
628
|
* float value = 1 [
|
|
549
629
|
* (buf.validate.field).float.example = 1.0,
|
|
550
|
-
* (buf.validate.field).float.example =
|
|
630
|
+
* (buf.validate.field).float.example = inf
|
|
551
631
|
* ];
|
|
552
632
|
* }
|
|
553
633
|
* ```
|
|
@@ -562,7 +642,7 @@ export type FloatRules = Message<"buf.validate.FloatRules"> & {
|
|
|
562
642
|
*/
|
|
563
643
|
export declare const FloatRulesSchema: GenMessage<FloatRules>;
|
|
564
644
|
/**
|
|
565
|
-
* DoubleRules describes the
|
|
645
|
+
* DoubleRules describes the rules applied to `double` values. These
|
|
566
646
|
* rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type.
|
|
567
647
|
*
|
|
568
648
|
* @generated from message buf.validate.DoubleRules
|
|
@@ -688,7 +768,7 @@ export type DoubleRules = Message<"buf.validate.DoubleRules"> & {
|
|
|
688
768
|
* ```proto
|
|
689
769
|
* message MyDouble {
|
|
690
770
|
* // value must be in list [1.0, 2.0, 3.0]
|
|
691
|
-
*
|
|
771
|
+
* double value = 1 [(buf.validate.field).double = { in: [1.0, 2.0, 3.0] }];
|
|
692
772
|
* }
|
|
693
773
|
* ```
|
|
694
774
|
*
|
|
@@ -703,7 +783,7 @@ export type DoubleRules = Message<"buf.validate.DoubleRules"> & {
|
|
|
703
783
|
* ```proto
|
|
704
784
|
* message MyDouble {
|
|
705
785
|
* // value must not be in list [1.0, 2.0, 3.0]
|
|
706
|
-
*
|
|
786
|
+
* double value = 1 [(buf.validate.field).double = { not_in: [1.0, 2.0, 3.0] }];
|
|
707
787
|
* }
|
|
708
788
|
* ```
|
|
709
789
|
*
|
|
@@ -719,14 +799,14 @@ export type DoubleRules = Message<"buf.validate.DoubleRules"> & {
|
|
|
719
799
|
finite: boolean;
|
|
720
800
|
/**
|
|
721
801
|
* `example` specifies values that the field may have. These values SHOULD
|
|
722
|
-
* conform to other
|
|
802
|
+
* conform to other rules. `example` values will not impact validation
|
|
723
803
|
* but may be used as helpful guidance on how to populate the given field.
|
|
724
804
|
*
|
|
725
805
|
* ```proto
|
|
726
806
|
* message MyDouble {
|
|
727
807
|
* double value = 1 [
|
|
728
808
|
* (buf.validate.field).double.example = 1.0,
|
|
729
|
-
* (buf.validate.field).double.example =
|
|
809
|
+
* (buf.validate.field).double.example = inf
|
|
730
810
|
* ];
|
|
731
811
|
* }
|
|
732
812
|
* ```
|
|
@@ -741,7 +821,7 @@ export type DoubleRules = Message<"buf.validate.DoubleRules"> & {
|
|
|
741
821
|
*/
|
|
742
822
|
export declare const DoubleRulesSchema: GenMessage<DoubleRules>;
|
|
743
823
|
/**
|
|
744
|
-
* Int32Rules describes the
|
|
824
|
+
* Int32Rules describes the rules applied to `int32` values. These
|
|
745
825
|
* rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type.
|
|
746
826
|
*
|
|
747
827
|
* @generated from message buf.validate.Int32Rules
|
|
@@ -867,7 +947,7 @@ export type Int32Rules = Message<"buf.validate.Int32Rules"> & {
|
|
|
867
947
|
* ```proto
|
|
868
948
|
* message MyInt32 {
|
|
869
949
|
* // value must be in list [1, 2, 3]
|
|
870
|
-
*
|
|
950
|
+
* int32 value = 1 [(buf.validate.field).int32 = { in: [1, 2, 3] }];
|
|
871
951
|
* }
|
|
872
952
|
* ```
|
|
873
953
|
*
|
|
@@ -882,7 +962,7 @@ export type Int32Rules = Message<"buf.validate.Int32Rules"> & {
|
|
|
882
962
|
* ```proto
|
|
883
963
|
* message MyInt32 {
|
|
884
964
|
* // value must not be in list [1, 2, 3]
|
|
885
|
-
*
|
|
965
|
+
* int32 value = 1 [(buf.validate.field).int32 = { not_in: [1, 2, 3] }];
|
|
886
966
|
* }
|
|
887
967
|
* ```
|
|
888
968
|
*
|
|
@@ -891,7 +971,7 @@ export type Int32Rules = Message<"buf.validate.Int32Rules"> & {
|
|
|
891
971
|
notIn: number[];
|
|
892
972
|
/**
|
|
893
973
|
* `example` specifies values that the field may have. These values SHOULD
|
|
894
|
-
* conform to other
|
|
974
|
+
* conform to other rules. `example` values will not impact validation
|
|
895
975
|
* but may be used as helpful guidance on how to populate the given field.
|
|
896
976
|
*
|
|
897
977
|
* ```proto
|
|
@@ -913,7 +993,7 @@ export type Int32Rules = Message<"buf.validate.Int32Rules"> & {
|
|
|
913
993
|
*/
|
|
914
994
|
export declare const Int32RulesSchema: GenMessage<Int32Rules>;
|
|
915
995
|
/**
|
|
916
|
-
* Int64Rules describes the
|
|
996
|
+
* Int64Rules describes the rules applied to `int64` values. These
|
|
917
997
|
* rules may also be applied to the `google.protobuf.Int64Value` Well-Known-Type.
|
|
918
998
|
*
|
|
919
999
|
* @generated from message buf.validate.Int64Rules
|
|
@@ -1039,7 +1119,7 @@ export type Int64Rules = Message<"buf.validate.Int64Rules"> & {
|
|
|
1039
1119
|
* ```proto
|
|
1040
1120
|
* message MyInt64 {
|
|
1041
1121
|
* // value must be in list [1, 2, 3]
|
|
1042
|
-
*
|
|
1122
|
+
* int64 value = 1 [(buf.validate.field).int64 = { in: [1, 2, 3] }];
|
|
1043
1123
|
* }
|
|
1044
1124
|
* ```
|
|
1045
1125
|
*
|
|
@@ -1054,7 +1134,7 @@ export type Int64Rules = Message<"buf.validate.Int64Rules"> & {
|
|
|
1054
1134
|
* ```proto
|
|
1055
1135
|
* message MyInt64 {
|
|
1056
1136
|
* // value must not be in list [1, 2, 3]
|
|
1057
|
-
*
|
|
1137
|
+
* int64 value = 1 [(buf.validate.field).int64 = { not_in: [1, 2, 3] }];
|
|
1058
1138
|
* }
|
|
1059
1139
|
* ```
|
|
1060
1140
|
*
|
|
@@ -1063,7 +1143,7 @@ export type Int64Rules = Message<"buf.validate.Int64Rules"> & {
|
|
|
1063
1143
|
notIn: bigint[];
|
|
1064
1144
|
/**
|
|
1065
1145
|
* `example` specifies values that the field may have. These values SHOULD
|
|
1066
|
-
* conform to other
|
|
1146
|
+
* conform to other rules. `example` values will not impact validation
|
|
1067
1147
|
* but may be used as helpful guidance on how to populate the given field.
|
|
1068
1148
|
*
|
|
1069
1149
|
* ```proto
|
|
@@ -1085,7 +1165,7 @@ export type Int64Rules = Message<"buf.validate.Int64Rules"> & {
|
|
|
1085
1165
|
*/
|
|
1086
1166
|
export declare const Int64RulesSchema: GenMessage<Int64Rules>;
|
|
1087
1167
|
/**
|
|
1088
|
-
* UInt32Rules describes the
|
|
1168
|
+
* UInt32Rules describes the rules applied to `uint32` values. These
|
|
1089
1169
|
* rules may also be applied to the `google.protobuf.UInt32Value` Well-Known-Type.
|
|
1090
1170
|
*
|
|
1091
1171
|
* @generated from message buf.validate.UInt32Rules
|
|
@@ -1211,7 +1291,7 @@ export type UInt32Rules = Message<"buf.validate.UInt32Rules"> & {
|
|
|
1211
1291
|
* ```proto
|
|
1212
1292
|
* message MyUInt32 {
|
|
1213
1293
|
* // value must be in list [1, 2, 3]
|
|
1214
|
-
*
|
|
1294
|
+
* uint32 value = 1 [(buf.validate.field).uint32 = { in: [1, 2, 3] }];
|
|
1215
1295
|
* }
|
|
1216
1296
|
* ```
|
|
1217
1297
|
*
|
|
@@ -1226,7 +1306,7 @@ export type UInt32Rules = Message<"buf.validate.UInt32Rules"> & {
|
|
|
1226
1306
|
* ```proto
|
|
1227
1307
|
* message MyUInt32 {
|
|
1228
1308
|
* // value must not be in list [1, 2, 3]
|
|
1229
|
-
*
|
|
1309
|
+
* uint32 value = 1 [(buf.validate.field).uint32 = { not_in: [1, 2, 3] }];
|
|
1230
1310
|
* }
|
|
1231
1311
|
* ```
|
|
1232
1312
|
*
|
|
@@ -1235,7 +1315,7 @@ export type UInt32Rules = Message<"buf.validate.UInt32Rules"> & {
|
|
|
1235
1315
|
notIn: number[];
|
|
1236
1316
|
/**
|
|
1237
1317
|
* `example` specifies values that the field may have. These values SHOULD
|
|
1238
|
-
* conform to other
|
|
1318
|
+
* conform to other rules. `example` values will not impact validation
|
|
1239
1319
|
* but may be used as helpful guidance on how to populate the given field.
|
|
1240
1320
|
*
|
|
1241
1321
|
* ```proto
|
|
@@ -1257,7 +1337,7 @@ export type UInt32Rules = Message<"buf.validate.UInt32Rules"> & {
|
|
|
1257
1337
|
*/
|
|
1258
1338
|
export declare const UInt32RulesSchema: GenMessage<UInt32Rules>;
|
|
1259
1339
|
/**
|
|
1260
|
-
* UInt64Rules describes the
|
|
1340
|
+
* UInt64Rules describes the rules applied to `uint64` values. These
|
|
1261
1341
|
* rules may also be applied to the `google.protobuf.UInt64Value` Well-Known-Type.
|
|
1262
1342
|
*
|
|
1263
1343
|
* @generated from message buf.validate.UInt64Rules
|
|
@@ -1383,7 +1463,7 @@ export type UInt64Rules = Message<"buf.validate.UInt64Rules"> & {
|
|
|
1383
1463
|
* ```proto
|
|
1384
1464
|
* message MyUInt64 {
|
|
1385
1465
|
* // value must be in list [1, 2, 3]
|
|
1386
|
-
*
|
|
1466
|
+
* uint64 value = 1 [(buf.validate.field).uint64 = { in: [1, 2, 3] }];
|
|
1387
1467
|
* }
|
|
1388
1468
|
* ```
|
|
1389
1469
|
*
|
|
@@ -1398,7 +1478,7 @@ export type UInt64Rules = Message<"buf.validate.UInt64Rules"> & {
|
|
|
1398
1478
|
* ```proto
|
|
1399
1479
|
* message MyUInt64 {
|
|
1400
1480
|
* // value must not be in list [1, 2, 3]
|
|
1401
|
-
*
|
|
1481
|
+
* uint64 value = 1 [(buf.validate.field).uint64 = { not_in: [1, 2, 3] }];
|
|
1402
1482
|
* }
|
|
1403
1483
|
* ```
|
|
1404
1484
|
*
|
|
@@ -1407,7 +1487,7 @@ export type UInt64Rules = Message<"buf.validate.UInt64Rules"> & {
|
|
|
1407
1487
|
notIn: bigint[];
|
|
1408
1488
|
/**
|
|
1409
1489
|
* `example` specifies values that the field may have. These values SHOULD
|
|
1410
|
-
* conform to other
|
|
1490
|
+
* conform to other rules. `example` values will not impact validation
|
|
1411
1491
|
* but may be used as helpful guidance on how to populate the given field.
|
|
1412
1492
|
*
|
|
1413
1493
|
* ```proto
|
|
@@ -1429,7 +1509,7 @@ export type UInt64Rules = Message<"buf.validate.UInt64Rules"> & {
|
|
|
1429
1509
|
*/
|
|
1430
1510
|
export declare const UInt64RulesSchema: GenMessage<UInt64Rules>;
|
|
1431
1511
|
/**
|
|
1432
|
-
* SInt32Rules describes the
|
|
1512
|
+
* SInt32Rules describes the rules applied to `sint32` values.
|
|
1433
1513
|
*
|
|
1434
1514
|
* @generated from message buf.validate.SInt32Rules
|
|
1435
1515
|
*/
|
|
@@ -1554,7 +1634,7 @@ export type SInt32Rules = Message<"buf.validate.SInt32Rules"> & {
|
|
|
1554
1634
|
* ```proto
|
|
1555
1635
|
* message MySInt32 {
|
|
1556
1636
|
* // value must be in list [1, 2, 3]
|
|
1557
|
-
*
|
|
1637
|
+
* sint32 value = 1 [(buf.validate.field).sint32 = { in: [1, 2, 3] }];
|
|
1558
1638
|
* }
|
|
1559
1639
|
* ```
|
|
1560
1640
|
*
|
|
@@ -1569,7 +1649,7 @@ export type SInt32Rules = Message<"buf.validate.SInt32Rules"> & {
|
|
|
1569
1649
|
* ```proto
|
|
1570
1650
|
* message MySInt32 {
|
|
1571
1651
|
* // value must not be in list [1, 2, 3]
|
|
1572
|
-
*
|
|
1652
|
+
* sint32 value = 1 [(buf.validate.field).sint32 = { not_in: [1, 2, 3] }];
|
|
1573
1653
|
* }
|
|
1574
1654
|
* ```
|
|
1575
1655
|
*
|
|
@@ -1578,7 +1658,7 @@ export type SInt32Rules = Message<"buf.validate.SInt32Rules"> & {
|
|
|
1578
1658
|
notIn: number[];
|
|
1579
1659
|
/**
|
|
1580
1660
|
* `example` specifies values that the field may have. These values SHOULD
|
|
1581
|
-
* conform to other
|
|
1661
|
+
* conform to other rules. `example` values will not impact validation
|
|
1582
1662
|
* but may be used as helpful guidance on how to populate the given field.
|
|
1583
1663
|
*
|
|
1584
1664
|
* ```proto
|
|
@@ -1600,7 +1680,7 @@ export type SInt32Rules = Message<"buf.validate.SInt32Rules"> & {
|
|
|
1600
1680
|
*/
|
|
1601
1681
|
export declare const SInt32RulesSchema: GenMessage<SInt32Rules>;
|
|
1602
1682
|
/**
|
|
1603
|
-
* SInt64Rules describes the
|
|
1683
|
+
* SInt64Rules describes the rules applied to `sint64` values.
|
|
1604
1684
|
*
|
|
1605
1685
|
* @generated from message buf.validate.SInt64Rules
|
|
1606
1686
|
*/
|
|
@@ -1725,7 +1805,7 @@ export type SInt64Rules = Message<"buf.validate.SInt64Rules"> & {
|
|
|
1725
1805
|
* ```proto
|
|
1726
1806
|
* message MySInt64 {
|
|
1727
1807
|
* // value must be in list [1, 2, 3]
|
|
1728
|
-
*
|
|
1808
|
+
* sint64 value = 1 [(buf.validate.field).sint64 = { in: [1, 2, 3] }];
|
|
1729
1809
|
* }
|
|
1730
1810
|
* ```
|
|
1731
1811
|
*
|
|
@@ -1740,7 +1820,7 @@ export type SInt64Rules = Message<"buf.validate.SInt64Rules"> & {
|
|
|
1740
1820
|
* ```proto
|
|
1741
1821
|
* message MySInt64 {
|
|
1742
1822
|
* // value must not be in list [1, 2, 3]
|
|
1743
|
-
*
|
|
1823
|
+
* sint64 value = 1 [(buf.validate.field).sint64 = { not_in: [1, 2, 3] }];
|
|
1744
1824
|
* }
|
|
1745
1825
|
* ```
|
|
1746
1826
|
*
|
|
@@ -1749,7 +1829,7 @@ export type SInt64Rules = Message<"buf.validate.SInt64Rules"> & {
|
|
|
1749
1829
|
notIn: bigint[];
|
|
1750
1830
|
/**
|
|
1751
1831
|
* `example` specifies values that the field may have. These values SHOULD
|
|
1752
|
-
* conform to other
|
|
1832
|
+
* conform to other rules. `example` values will not impact validation
|
|
1753
1833
|
* but may be used as helpful guidance on how to populate the given field.
|
|
1754
1834
|
*
|
|
1755
1835
|
* ```proto
|
|
@@ -1771,7 +1851,7 @@ export type SInt64Rules = Message<"buf.validate.SInt64Rules"> & {
|
|
|
1771
1851
|
*/
|
|
1772
1852
|
export declare const SInt64RulesSchema: GenMessage<SInt64Rules>;
|
|
1773
1853
|
/**
|
|
1774
|
-
* Fixed32Rules describes the
|
|
1854
|
+
* Fixed32Rules describes the rules applied to `fixed32` values.
|
|
1775
1855
|
*
|
|
1776
1856
|
* @generated from message buf.validate.Fixed32Rules
|
|
1777
1857
|
*/
|
|
@@ -1896,7 +1976,7 @@ export type Fixed32Rules = Message<"buf.validate.Fixed32Rules"> & {
|
|
|
1896
1976
|
* ```proto
|
|
1897
1977
|
* message MyFixed32 {
|
|
1898
1978
|
* // value must be in list [1, 2, 3]
|
|
1899
|
-
*
|
|
1979
|
+
* fixed32 value = 1 [(buf.validate.field).fixed32 = { in: [1, 2, 3] }];
|
|
1900
1980
|
* }
|
|
1901
1981
|
* ```
|
|
1902
1982
|
*
|
|
@@ -1911,7 +1991,7 @@ export type Fixed32Rules = Message<"buf.validate.Fixed32Rules"> & {
|
|
|
1911
1991
|
* ```proto
|
|
1912
1992
|
* message MyFixed32 {
|
|
1913
1993
|
* // value must not be in list [1, 2, 3]
|
|
1914
|
-
*
|
|
1994
|
+
* fixed32 value = 1 [(buf.validate.field).fixed32 = { not_in: [1, 2, 3] }];
|
|
1915
1995
|
* }
|
|
1916
1996
|
* ```
|
|
1917
1997
|
*
|
|
@@ -1920,7 +2000,7 @@ export type Fixed32Rules = Message<"buf.validate.Fixed32Rules"> & {
|
|
|
1920
2000
|
notIn: number[];
|
|
1921
2001
|
/**
|
|
1922
2002
|
* `example` specifies values that the field may have. These values SHOULD
|
|
1923
|
-
* conform to other
|
|
2003
|
+
* conform to other rules. `example` values will not impact validation
|
|
1924
2004
|
* but may be used as helpful guidance on how to populate the given field.
|
|
1925
2005
|
*
|
|
1926
2006
|
* ```proto
|
|
@@ -1942,7 +2022,7 @@ export type Fixed32Rules = Message<"buf.validate.Fixed32Rules"> & {
|
|
|
1942
2022
|
*/
|
|
1943
2023
|
export declare const Fixed32RulesSchema: GenMessage<Fixed32Rules>;
|
|
1944
2024
|
/**
|
|
1945
|
-
* Fixed64Rules describes the
|
|
2025
|
+
* Fixed64Rules describes the rules applied to `fixed64` values.
|
|
1946
2026
|
*
|
|
1947
2027
|
* @generated from message buf.validate.Fixed64Rules
|
|
1948
2028
|
*/
|
|
@@ -2067,7 +2147,7 @@ export type Fixed64Rules = Message<"buf.validate.Fixed64Rules"> & {
|
|
|
2067
2147
|
* ```proto
|
|
2068
2148
|
* message MyFixed64 {
|
|
2069
2149
|
* // value must be in list [1, 2, 3]
|
|
2070
|
-
*
|
|
2150
|
+
* fixed64 value = 1 [(buf.validate.field).fixed64 = { in: [1, 2, 3] }];
|
|
2071
2151
|
* }
|
|
2072
2152
|
* ```
|
|
2073
2153
|
*
|
|
@@ -2082,7 +2162,7 @@ export type Fixed64Rules = Message<"buf.validate.Fixed64Rules"> & {
|
|
|
2082
2162
|
* ```proto
|
|
2083
2163
|
* message MyFixed64 {
|
|
2084
2164
|
* // value must not be in list [1, 2, 3]
|
|
2085
|
-
*
|
|
2165
|
+
* fixed64 value = 1 [(buf.validate.field).fixed64 = { not_in: [1, 2, 3] }];
|
|
2086
2166
|
* }
|
|
2087
2167
|
* ```
|
|
2088
2168
|
*
|
|
@@ -2091,7 +2171,7 @@ export type Fixed64Rules = Message<"buf.validate.Fixed64Rules"> & {
|
|
|
2091
2171
|
notIn: bigint[];
|
|
2092
2172
|
/**
|
|
2093
2173
|
* `example` specifies values that the field may have. These values SHOULD
|
|
2094
|
-
* conform to other
|
|
2174
|
+
* conform to other rules. `example` values will not impact validation
|
|
2095
2175
|
* but may be used as helpful guidance on how to populate the given field.
|
|
2096
2176
|
*
|
|
2097
2177
|
* ```proto
|
|
@@ -2113,7 +2193,7 @@ export type Fixed64Rules = Message<"buf.validate.Fixed64Rules"> & {
|
|
|
2113
2193
|
*/
|
|
2114
2194
|
export declare const Fixed64RulesSchema: GenMessage<Fixed64Rules>;
|
|
2115
2195
|
/**
|
|
2116
|
-
* SFixed32Rules describes the
|
|
2196
|
+
* SFixed32Rules describes the rules applied to `fixed32` values.
|
|
2117
2197
|
*
|
|
2118
2198
|
* @generated from message buf.validate.SFixed32Rules
|
|
2119
2199
|
*/
|
|
@@ -2238,7 +2318,7 @@ export type SFixed32Rules = Message<"buf.validate.SFixed32Rules"> & {
|
|
|
2238
2318
|
* ```proto
|
|
2239
2319
|
* message MySFixed32 {
|
|
2240
2320
|
* // value must be in list [1, 2, 3]
|
|
2241
|
-
*
|
|
2321
|
+
* sfixed32 value = 1 [(buf.validate.field).sfixed32 = { in: [1, 2, 3] }];
|
|
2242
2322
|
* }
|
|
2243
2323
|
* ```
|
|
2244
2324
|
*
|
|
@@ -2253,7 +2333,7 @@ export type SFixed32Rules = Message<"buf.validate.SFixed32Rules"> & {
|
|
|
2253
2333
|
* ```proto
|
|
2254
2334
|
* message MySFixed32 {
|
|
2255
2335
|
* // value must not be in list [1, 2, 3]
|
|
2256
|
-
*
|
|
2336
|
+
* sfixed32 value = 1 [(buf.validate.field).sfixed32 = { not_in: [1, 2, 3] }];
|
|
2257
2337
|
* }
|
|
2258
2338
|
* ```
|
|
2259
2339
|
*
|
|
@@ -2262,7 +2342,7 @@ export type SFixed32Rules = Message<"buf.validate.SFixed32Rules"> & {
|
|
|
2262
2342
|
notIn: number[];
|
|
2263
2343
|
/**
|
|
2264
2344
|
* `example` specifies values that the field may have. These values SHOULD
|
|
2265
|
-
* conform to other
|
|
2345
|
+
* conform to other rules. `example` values will not impact validation
|
|
2266
2346
|
* but may be used as helpful guidance on how to populate the given field.
|
|
2267
2347
|
*
|
|
2268
2348
|
* ```proto
|
|
@@ -2284,7 +2364,7 @@ export type SFixed32Rules = Message<"buf.validate.SFixed32Rules"> & {
|
|
|
2284
2364
|
*/
|
|
2285
2365
|
export declare const SFixed32RulesSchema: GenMessage<SFixed32Rules>;
|
|
2286
2366
|
/**
|
|
2287
|
-
* SFixed64Rules describes the
|
|
2367
|
+
* SFixed64Rules describes the rules applied to `fixed64` values.
|
|
2288
2368
|
*
|
|
2289
2369
|
* @generated from message buf.validate.SFixed64Rules
|
|
2290
2370
|
*/
|
|
@@ -2409,7 +2489,7 @@ export type SFixed64Rules = Message<"buf.validate.SFixed64Rules"> & {
|
|
|
2409
2489
|
* ```proto
|
|
2410
2490
|
* message MySFixed64 {
|
|
2411
2491
|
* // value must be in list [1, 2, 3]
|
|
2412
|
-
*
|
|
2492
|
+
* sfixed64 value = 1 [(buf.validate.field).sfixed64 = { in: [1, 2, 3] }];
|
|
2413
2493
|
* }
|
|
2414
2494
|
* ```
|
|
2415
2495
|
*
|
|
@@ -2424,7 +2504,7 @@ export type SFixed64Rules = Message<"buf.validate.SFixed64Rules"> & {
|
|
|
2424
2504
|
* ```proto
|
|
2425
2505
|
* message MySFixed64 {
|
|
2426
2506
|
* // value must not be in list [1, 2, 3]
|
|
2427
|
-
*
|
|
2507
|
+
* sfixed64 value = 1 [(buf.validate.field).sfixed64 = { not_in: [1, 2, 3] }];
|
|
2428
2508
|
* }
|
|
2429
2509
|
* ```
|
|
2430
2510
|
*
|
|
@@ -2433,7 +2513,7 @@ export type SFixed64Rules = Message<"buf.validate.SFixed64Rules"> & {
|
|
|
2433
2513
|
notIn: bigint[];
|
|
2434
2514
|
/**
|
|
2435
2515
|
* `example` specifies values that the field may have. These values SHOULD
|
|
2436
|
-
* conform to other
|
|
2516
|
+
* conform to other rules. `example` values will not impact validation
|
|
2437
2517
|
* but may be used as helpful guidance on how to populate the given field.
|
|
2438
2518
|
*
|
|
2439
2519
|
* ```proto
|
|
@@ -2455,7 +2535,7 @@ export type SFixed64Rules = Message<"buf.validate.SFixed64Rules"> & {
|
|
|
2455
2535
|
*/
|
|
2456
2536
|
export declare const SFixed64RulesSchema: GenMessage<SFixed64Rules>;
|
|
2457
2537
|
/**
|
|
2458
|
-
* BoolRules describes the
|
|
2538
|
+
* BoolRules describes the rules applied to `bool` values. These rules
|
|
2459
2539
|
* may also be applied to the `google.protobuf.BoolValue` Well-Known-Type.
|
|
2460
2540
|
*
|
|
2461
2541
|
* @generated from message buf.validate.BoolRules
|
|
@@ -2477,7 +2557,7 @@ export type BoolRules = Message<"buf.validate.BoolRules"> & {
|
|
|
2477
2557
|
const: boolean;
|
|
2478
2558
|
/**
|
|
2479
2559
|
* `example` specifies values that the field may have. These values SHOULD
|
|
2480
|
-
* conform to other
|
|
2560
|
+
* conform to other rules. `example` values will not impact validation
|
|
2481
2561
|
* but may be used as helpful guidance on how to populate the given field.
|
|
2482
2562
|
*
|
|
2483
2563
|
* ```proto
|
|
@@ -2499,7 +2579,7 @@ export type BoolRules = Message<"buf.validate.BoolRules"> & {
|
|
|
2499
2579
|
*/
|
|
2500
2580
|
export declare const BoolRulesSchema: GenMessage<BoolRules>;
|
|
2501
2581
|
/**
|
|
2502
|
-
* StringRules describes the
|
|
2582
|
+
* StringRules describes the rules applied to `string` values These
|
|
2503
2583
|
* rules may also be applied to the `google.protobuf.StringValue` Well-Known-Type.
|
|
2504
2584
|
*
|
|
2505
2585
|
* @generated from message buf.validate.StringRules
|
|
@@ -2698,7 +2778,7 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2698
2778
|
* ```proto
|
|
2699
2779
|
* message MyString {
|
|
2700
2780
|
* // value must be in list ["apple", "banana"]
|
|
2701
|
-
*
|
|
2781
|
+
* string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"];
|
|
2702
2782
|
* }
|
|
2703
2783
|
* ```
|
|
2704
2784
|
*
|
|
@@ -2712,7 +2792,7 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2712
2792
|
* ```proto
|
|
2713
2793
|
* message MyString {
|
|
2714
2794
|
* // value must not be in list ["orange", "grape"]
|
|
2715
|
-
*
|
|
2795
|
+
* string value = 1 [(buf.validate.field).string.not_in = "orange", (buf.validate.field).string.not_in = "grape"];
|
|
2716
2796
|
* }
|
|
2717
2797
|
* ```
|
|
2718
2798
|
*
|
|
@@ -2720,15 +2800,21 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2720
2800
|
*/
|
|
2721
2801
|
notIn: string[];
|
|
2722
2802
|
/**
|
|
2723
|
-
* `WellKnown` rules provide advanced
|
|
2724
|
-
* patterns
|
|
2803
|
+
* `WellKnown` rules provide advanced rules against common string
|
|
2804
|
+
* patterns.
|
|
2725
2805
|
*
|
|
2726
2806
|
* @generated from oneof buf.validate.StringRules.well_known
|
|
2727
2807
|
*/
|
|
2728
2808
|
wellKnown: {
|
|
2729
2809
|
/**
|
|
2730
|
-
* `email` specifies that the field value must be a valid email address
|
|
2731
|
-
*
|
|
2810
|
+
* `email` specifies that the field value must be a valid email address, for
|
|
2811
|
+
* example "foo@example.com".
|
|
2812
|
+
*
|
|
2813
|
+
* 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).
|
|
2814
|
+
* Note that this standard willfully deviates from [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322),
|
|
2815
|
+
* which allows many unexpected forms of email addresses and will easily match
|
|
2816
|
+
* a typographical error.
|
|
2817
|
+
*
|
|
2732
2818
|
* If the field value isn't a valid email address, an error message will be generated.
|
|
2733
2819
|
*
|
|
2734
2820
|
* ```proto
|
|
@@ -2744,10 +2830,18 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2744
2830
|
case: "email";
|
|
2745
2831
|
} | {
|
|
2746
2832
|
/**
|
|
2747
|
-
* `hostname` specifies that the field value must be a valid
|
|
2748
|
-
*
|
|
2749
|
-
*
|
|
2750
|
-
* valid hostname
|
|
2833
|
+
* `hostname` specifies that the field value must be a valid hostname, for
|
|
2834
|
+
* example "foo.example.com".
|
|
2835
|
+
*
|
|
2836
|
+
* A valid hostname follows the rules below:
|
|
2837
|
+
* - The name consists of one or more labels, separated by a dot (".").
|
|
2838
|
+
* - Each label can be 1 to 63 alphanumeric characters.
|
|
2839
|
+
* - A label can contain hyphens ("-"), but must not start or end with a hyphen.
|
|
2840
|
+
* - The right-most label must not be digits only.
|
|
2841
|
+
* - The name can have a trailing dot—for example, "foo.example.com.".
|
|
2842
|
+
* - The name can be 253 characters at most, excluding the optional trailing dot.
|
|
2843
|
+
*
|
|
2844
|
+
* If the field value isn't a valid hostname, an error message will be generated.
|
|
2751
2845
|
*
|
|
2752
2846
|
* ```proto
|
|
2753
2847
|
* message MyString {
|
|
@@ -2762,8 +2856,15 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2762
2856
|
case: "hostname";
|
|
2763
2857
|
} | {
|
|
2764
2858
|
/**
|
|
2765
|
-
* `ip` specifies that the field value must be a valid IP
|
|
2766
|
-
*
|
|
2859
|
+
* `ip` specifies that the field value must be a valid IP (v4 or v6) address.
|
|
2860
|
+
*
|
|
2861
|
+
* IPv4 addresses are expected in the dotted decimal format—for example, "192.168.5.21".
|
|
2862
|
+
* IPv6 addresses are expected in their text representation—for example, "::1",
|
|
2863
|
+
* or "2001:0DB8:ABCD:0012::0".
|
|
2864
|
+
*
|
|
2865
|
+
* Both formats are well-defined in the internet standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986).
|
|
2866
|
+
* Zone identifiers for IPv6 addresses (for example, "fe80::a%en1") are supported.
|
|
2867
|
+
*
|
|
2767
2868
|
* If the field value isn't a valid IP address, an error message will be
|
|
2768
2869
|
* generated.
|
|
2769
2870
|
*
|
|
@@ -2780,9 +2881,9 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2780
2881
|
case: "ip";
|
|
2781
2882
|
} | {
|
|
2782
2883
|
/**
|
|
2783
|
-
* `ipv4` specifies that the field value must be a valid IPv4
|
|
2784
|
-
*
|
|
2785
|
-
* will be generated.
|
|
2884
|
+
* `ipv4` specifies that the field value must be a valid IPv4 address—for
|
|
2885
|
+
* example "192.168.5.21". If the field value isn't a valid IPv4 address, an
|
|
2886
|
+
* error message will be generated.
|
|
2786
2887
|
*
|
|
2787
2888
|
* ```proto
|
|
2788
2889
|
* message MyString {
|
|
@@ -2797,9 +2898,9 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2797
2898
|
case: "ipv4";
|
|
2798
2899
|
} | {
|
|
2799
2900
|
/**
|
|
2800
|
-
* `ipv6` specifies that the field value must be a valid
|
|
2801
|
-
*
|
|
2802
|
-
* not a valid IPv6 address, an error message will be generated.
|
|
2901
|
+
* `ipv6` specifies that the field value must be a valid IPv6 address—for
|
|
2902
|
+
* example "::1", or "d7a:115c:a1e0:ab12:4843:cd96:626b:430b". If the field
|
|
2903
|
+
* value is not a valid IPv6 address, an error message will be generated.
|
|
2803
2904
|
*
|
|
2804
2905
|
* ```proto
|
|
2805
2906
|
* message MyString {
|
|
@@ -2814,9 +2915,13 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2814
2915
|
case: "ipv6";
|
|
2815
2916
|
} | {
|
|
2816
2917
|
/**
|
|
2817
|
-
* `uri` specifies that the field value must be a valid,
|
|
2818
|
-
*
|
|
2819
|
-
*
|
|
2918
|
+
* `uri` specifies that the field value must be a valid URI, for example
|
|
2919
|
+
* "https://example.com/foo/bar?baz=quux#frag".
|
|
2920
|
+
*
|
|
2921
|
+
* URI is defined in the internet standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986).
|
|
2922
|
+
* Zone Identifiers in IPv6 address literals are supported ([RFC 6874](https://datatracker.ietf.org/doc/html/rfc6874)).
|
|
2923
|
+
*
|
|
2924
|
+
* If the field value isn't a valid URI, an error message will be generated.
|
|
2820
2925
|
*
|
|
2821
2926
|
* ```proto
|
|
2822
2927
|
* message MyString {
|
|
@@ -2831,13 +2936,20 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2831
2936
|
case: "uri";
|
|
2832
2937
|
} | {
|
|
2833
2938
|
/**
|
|
2834
|
-
* `uri_ref` specifies that the field value must be a valid URI
|
|
2835
|
-
*
|
|
2836
|
-
*
|
|
2939
|
+
* `uri_ref` specifies that the field value must be a valid URI Reference—either
|
|
2940
|
+
* a URI such as "https://example.com/foo/bar?baz=quux#frag", or a Relative
|
|
2941
|
+
* Reference such as "./foo/bar?query".
|
|
2942
|
+
*
|
|
2943
|
+
* URI, URI Reference, and Relative Reference are defined in the internet
|
|
2944
|
+
* standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). Zone
|
|
2945
|
+
* Identifiers in IPv6 address literals are supported ([RFC 6874](https://datatracker.ietf.org/doc/html/rfc6874)).
|
|
2946
|
+
*
|
|
2947
|
+
* If the field value isn't a valid URI Reference, an error message will be
|
|
2948
|
+
* generated.
|
|
2837
2949
|
*
|
|
2838
2950
|
* ```proto
|
|
2839
2951
|
* message MyString {
|
|
2840
|
-
* // value must be a valid URI
|
|
2952
|
+
* // value must be a valid URI Reference
|
|
2841
2953
|
* string value = 1 [(buf.validate.field).string.uri_ref = true];
|
|
2842
2954
|
* }
|
|
2843
2955
|
* ```
|
|
@@ -2849,10 +2961,9 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2849
2961
|
} | {
|
|
2850
2962
|
/**
|
|
2851
2963
|
* `address` specifies that the field value must be either a valid hostname
|
|
2852
|
-
*
|
|
2853
|
-
*
|
|
2854
|
-
*
|
|
2855
|
-
* message will be generated.
|
|
2964
|
+
* (for example, "example.com"), or a valid IP (v4 or v6) address (for example,
|
|
2965
|
+
* "192.168.0.1", or "::1"). If the field value isn't a valid hostname or IP,
|
|
2966
|
+
* an error message will be generated.
|
|
2856
2967
|
*
|
|
2857
2968
|
* ```proto
|
|
2858
2969
|
* message MyString {
|
|
@@ -2868,7 +2979,7 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2868
2979
|
} | {
|
|
2869
2980
|
/**
|
|
2870
2981
|
* `uuid` specifies that the field value must be a valid UUID as defined by
|
|
2871
|
-
* [RFC 4122](https://
|
|
2982
|
+
* [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2). If the
|
|
2872
2983
|
* field value isn't a valid UUID, an error message will be generated.
|
|
2873
2984
|
*
|
|
2874
2985
|
* ```proto
|
|
@@ -2885,7 +2996,7 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2885
2996
|
} | {
|
|
2886
2997
|
/**
|
|
2887
2998
|
* `tuuid` (trimmed UUID) specifies that the field value must be a valid UUID as
|
|
2888
|
-
* defined by [RFC 4122](https://
|
|
2999
|
+
* defined by [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2) with all dashes
|
|
2889
3000
|
* omitted. If the field value isn't a valid UUID without dashes, an error message
|
|
2890
3001
|
* will be generated.
|
|
2891
3002
|
*
|
|
@@ -2902,10 +3013,10 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2902
3013
|
case: "tuuid";
|
|
2903
3014
|
} | {
|
|
2904
3015
|
/**
|
|
2905
|
-
* `ip_with_prefixlen` specifies that the field value must be a valid IP
|
|
2906
|
-
* address with prefix length
|
|
2907
|
-
*
|
|
2908
|
-
*
|
|
3016
|
+
* `ip_with_prefixlen` specifies that the field value must be a valid IP
|
|
3017
|
+
* (v4 or v6) address with prefix length—for example, "192.168.5.21/16" or
|
|
3018
|
+
* "2001:0DB8:ABCD:0012::F1/64". If the field value isn't a valid IP with
|
|
3019
|
+
* prefix length, an error message will be generated.
|
|
2909
3020
|
*
|
|
2910
3021
|
* ```proto
|
|
2911
3022
|
* message MyString {
|
|
@@ -2921,9 +3032,9 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2921
3032
|
} | {
|
|
2922
3033
|
/**
|
|
2923
3034
|
* `ipv4_with_prefixlen` specifies that the field value must be a valid
|
|
2924
|
-
* IPv4 address with prefix.
|
|
2925
|
-
*
|
|
2926
|
-
*
|
|
3035
|
+
* IPv4 address with prefix length—for example, "192.168.5.21/16". If the
|
|
3036
|
+
* field value isn't a valid IPv4 address with prefix length, an error
|
|
3037
|
+
* message will be generated.
|
|
2927
3038
|
*
|
|
2928
3039
|
* ```proto
|
|
2929
3040
|
* message MyString {
|
|
@@ -2939,7 +3050,7 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2939
3050
|
} | {
|
|
2940
3051
|
/**
|
|
2941
3052
|
* `ipv6_with_prefixlen` specifies that the field value must be a valid
|
|
2942
|
-
* IPv6 address with prefix length.
|
|
3053
|
+
* IPv6 address with prefix length—for example, "2001:0DB8:ABCD:0012::F1/64".
|
|
2943
3054
|
* If the field value is not a valid IPv6 address with prefix length,
|
|
2944
3055
|
* an error message will be generated.
|
|
2945
3056
|
*
|
|
@@ -2956,10 +3067,15 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2956
3067
|
case: "ipv6WithPrefixlen";
|
|
2957
3068
|
} | {
|
|
2958
3069
|
/**
|
|
2959
|
-
* `ip_prefix` specifies that the field value must be a valid IP (v4 or v6)
|
|
3070
|
+
* `ip_prefix` specifies that the field value must be a valid IP (v4 or v6)
|
|
3071
|
+
* prefix—for example, "192.168.0.0/16" or "2001:0DB8:ABCD:0012::0/64".
|
|
3072
|
+
*
|
|
3073
|
+
* The prefix must have all zeros for the unmasked bits. For example,
|
|
3074
|
+
* "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the
|
|
3075
|
+
* prefix, and the remaining 64 bits must be zero.
|
|
3076
|
+
*
|
|
2960
3077
|
* If the field value isn't a valid IP prefix, an error message will be
|
|
2961
|
-
* generated.
|
|
2962
|
-
* `127.0.0.0/16`, not `127.0.0.1/16`).
|
|
3078
|
+
* generated.
|
|
2963
3079
|
*
|
|
2964
3080
|
* ```proto
|
|
2965
3081
|
* message MyString {
|
|
@@ -2975,9 +3091,14 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2975
3091
|
} | {
|
|
2976
3092
|
/**
|
|
2977
3093
|
* `ipv4_prefix` specifies that the field value must be a valid IPv4
|
|
2978
|
-
* prefix
|
|
2979
|
-
*
|
|
2980
|
-
*
|
|
3094
|
+
* prefix, for example "192.168.0.0/16".
|
|
3095
|
+
*
|
|
3096
|
+
* The prefix must have all zeros for the unmasked bits. For example,
|
|
3097
|
+
* "192.168.0.0/16" designates the left-most 16 bits for the prefix,
|
|
3098
|
+
* and the remaining 16 bits must be zero.
|
|
3099
|
+
*
|
|
3100
|
+
* If the field value isn't a valid IPv4 prefix, an error message
|
|
3101
|
+
* will be generated.
|
|
2981
3102
|
*
|
|
2982
3103
|
* ```proto
|
|
2983
3104
|
* message MyString {
|
|
@@ -2992,10 +3113,15 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
2992
3113
|
case: "ipv4Prefix";
|
|
2993
3114
|
} | {
|
|
2994
3115
|
/**
|
|
2995
|
-
* `ipv6_prefix` specifies that the field value must be a valid IPv6 prefix
|
|
3116
|
+
* `ipv6_prefix` specifies that the field value must be a valid IPv6 prefix—for
|
|
3117
|
+
* example, "2001:0DB8:ABCD:0012::0/64".
|
|
3118
|
+
*
|
|
3119
|
+
* The prefix must have all zeros for the unmasked bits. For example,
|
|
3120
|
+
* "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the
|
|
3121
|
+
* prefix, and the remaining 64 bits must be zero.
|
|
3122
|
+
*
|
|
2996
3123
|
* If the field value is not a valid IPv6 prefix, an error message will be
|
|
2997
|
-
* generated.
|
|
2998
|
-
* (e.g., `2001:db8::/48`, not `2001:db8::1/48`).
|
|
3124
|
+
* generated.
|
|
2999
3125
|
*
|
|
3000
3126
|
* ```proto
|
|
3001
3127
|
* message MyString {
|
|
@@ -3010,10 +3136,16 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
3010
3136
|
case: "ipv6Prefix";
|
|
3011
3137
|
} | {
|
|
3012
3138
|
/**
|
|
3013
|
-
* `host_and_port` specifies the field value must be
|
|
3014
|
-
* pair
|
|
3015
|
-
*
|
|
3016
|
-
*
|
|
3139
|
+
* `host_and_port` specifies that the field value must be valid host/port
|
|
3140
|
+
* pair—for example, "example.com:8080".
|
|
3141
|
+
*
|
|
3142
|
+
* The host can be one of:
|
|
3143
|
+
* - An IPv4 address in dotted decimal format—for example, "192.168.5.21".
|
|
3144
|
+
* - An IPv6 address enclosed in square brackets—for example, "[2001:0DB8:ABCD:0012::F1]".
|
|
3145
|
+
* - A hostname—for example, "example.com".
|
|
3146
|
+
*
|
|
3147
|
+
* The port is separated by a colon. It must be non-empty, with a decimal number
|
|
3148
|
+
* in the range of 0-65535, inclusive.
|
|
3017
3149
|
*
|
|
3018
3150
|
* @generated from field: bool host_and_port = 32;
|
|
3019
3151
|
*/
|
|
@@ -3039,8 +3171,8 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
3039
3171
|
* | Name | Number | Description |
|
|
3040
3172
|
* |-------------------------------|--------|-------------------------------------------|
|
|
3041
3173
|
* | KNOWN_REGEX_UNSPECIFIED | 0 | |
|
|
3042
|
-
* | KNOWN_REGEX_HTTP_HEADER_NAME | 1 | HTTP header name as defined by [RFC 7230](https://
|
|
3043
|
-
* | KNOWN_REGEX_HTTP_HEADER_VALUE | 2 | HTTP header value as defined by [RFC 7230](https://
|
|
3174
|
+
* | KNOWN_REGEX_HTTP_HEADER_NAME | 1 | HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2) |
|
|
3175
|
+
* | 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) |
|
|
3044
3176
|
*
|
|
3045
3177
|
* @generated from field: buf.validate.KnownRegex well_known_regex = 24;
|
|
3046
3178
|
*/
|
|
@@ -3053,7 +3185,7 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
3053
3185
|
/**
|
|
3054
3186
|
* This applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to
|
|
3055
3187
|
* enable strict header validation. By default, this is true, and HTTP header
|
|
3056
|
-
* validations are [RFC-compliant](https://
|
|
3188
|
+
* validations are [RFC-compliant](https://datatracker.ietf.org/doc/html/rfc7230#section-3). Setting to false will enable looser
|
|
3057
3189
|
* validations that only disallow `\r\n\0` characters, which can be used to
|
|
3058
3190
|
* bypass header matching rules.
|
|
3059
3191
|
*
|
|
@@ -3069,7 +3201,7 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
3069
3201
|
strict: boolean;
|
|
3070
3202
|
/**
|
|
3071
3203
|
* `example` specifies values that the field may have. These values SHOULD
|
|
3072
|
-
* conform to other
|
|
3204
|
+
* conform to other rules. `example` values will not impact validation
|
|
3073
3205
|
* but may be used as helpful guidance on how to populate the given field.
|
|
3074
3206
|
*
|
|
3075
3207
|
* ```proto
|
|
@@ -3091,7 +3223,7 @@ export type StringRules = Message<"buf.validate.StringRules"> & {
|
|
|
3091
3223
|
*/
|
|
3092
3224
|
export declare const StringRulesSchema: GenMessage<StringRules>;
|
|
3093
3225
|
/**
|
|
3094
|
-
* BytesRules describe the
|
|
3226
|
+
* BytesRules describe the rules applied to `bytes` values. These rules
|
|
3095
3227
|
* may also be applied to the `google.protobuf.BytesValue` Well-Known-Type.
|
|
3096
3228
|
*
|
|
3097
3229
|
* @generated from message buf.validate.BytesRules
|
|
@@ -3249,7 +3381,7 @@ export type BytesRules = Message<"buf.validate.BytesRules"> & {
|
|
|
3249
3381
|
*/
|
|
3250
3382
|
notIn: Uint8Array[];
|
|
3251
3383
|
/**
|
|
3252
|
-
* WellKnown rules provide advanced
|
|
3384
|
+
* WellKnown rules provide advanced rules against common byte
|
|
3253
3385
|
* patterns
|
|
3254
3386
|
*
|
|
3255
3387
|
* @generated from oneof buf.validate.BytesRules.well_known
|
|
@@ -3257,7 +3389,7 @@ export type BytesRules = Message<"buf.validate.BytesRules"> & {
|
|
|
3257
3389
|
wellKnown: {
|
|
3258
3390
|
/**
|
|
3259
3391
|
* `ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format.
|
|
3260
|
-
* If the field value doesn't meet this
|
|
3392
|
+
* If the field value doesn't meet this rule, an error message is generated.
|
|
3261
3393
|
*
|
|
3262
3394
|
* ```proto
|
|
3263
3395
|
* message MyBytes {
|
|
@@ -3273,7 +3405,7 @@ export type BytesRules = Message<"buf.validate.BytesRules"> & {
|
|
|
3273
3405
|
} | {
|
|
3274
3406
|
/**
|
|
3275
3407
|
* `ipv4` ensures that the field `value` is a valid IPv4 address in byte format.
|
|
3276
|
-
* If the field value doesn't meet this
|
|
3408
|
+
* If the field value doesn't meet this rule, an error message is generated.
|
|
3277
3409
|
*
|
|
3278
3410
|
* ```proto
|
|
3279
3411
|
* message MyBytes {
|
|
@@ -3289,7 +3421,7 @@ export type BytesRules = Message<"buf.validate.BytesRules"> & {
|
|
|
3289
3421
|
} | {
|
|
3290
3422
|
/**
|
|
3291
3423
|
* `ipv6` ensures that the field `value` is a valid IPv6 address in byte format.
|
|
3292
|
-
* If the field value doesn't meet this
|
|
3424
|
+
* If the field value doesn't meet this rule, an error message is generated.
|
|
3293
3425
|
* ```proto
|
|
3294
3426
|
* message MyBytes {
|
|
3295
3427
|
* // value must be a valid IPv6 address
|
|
@@ -3307,7 +3439,7 @@ export type BytesRules = Message<"buf.validate.BytesRules"> & {
|
|
|
3307
3439
|
};
|
|
3308
3440
|
/**
|
|
3309
3441
|
* `example` specifies values that the field may have. These values SHOULD
|
|
3310
|
-
* conform to other
|
|
3442
|
+
* conform to other rules. `example` values will not impact validation
|
|
3311
3443
|
* but may be used as helpful guidance on how to populate the given field.
|
|
3312
3444
|
*
|
|
3313
3445
|
* ```proto
|
|
@@ -3329,7 +3461,7 @@ export type BytesRules = Message<"buf.validate.BytesRules"> & {
|
|
|
3329
3461
|
*/
|
|
3330
3462
|
export declare const BytesRulesSchema: GenMessage<BytesRules>;
|
|
3331
3463
|
/**
|
|
3332
|
-
* EnumRules describe the
|
|
3464
|
+
* EnumRules describe the rules applied to `enum` values.
|
|
3333
3465
|
*
|
|
3334
3466
|
* @generated from message buf.validate.EnumRules
|
|
3335
3467
|
*/
|
|
@@ -3418,7 +3550,7 @@ export type EnumRules = Message<"buf.validate.EnumRules"> & {
|
|
|
3418
3550
|
notIn: number[];
|
|
3419
3551
|
/**
|
|
3420
3552
|
* `example` specifies values that the field may have. These values SHOULD
|
|
3421
|
-
* conform to other
|
|
3553
|
+
* conform to other rules. `example` values will not impact validation
|
|
3422
3554
|
* but may be used as helpful guidance on how to populate the given field.
|
|
3423
3555
|
*
|
|
3424
3556
|
* ```proto
|
|
@@ -3444,7 +3576,7 @@ export type EnumRules = Message<"buf.validate.EnumRules"> & {
|
|
|
3444
3576
|
*/
|
|
3445
3577
|
export declare const EnumRulesSchema: GenMessage<EnumRules>;
|
|
3446
3578
|
/**
|
|
3447
|
-
* RepeatedRules describe the
|
|
3579
|
+
* RepeatedRules describe the rules applied to `repeated` values.
|
|
3448
3580
|
*
|
|
3449
3581
|
* @generated from message buf.validate.RepeatedRules
|
|
3450
3582
|
*/
|
|
@@ -3483,7 +3615,7 @@ export type RepeatedRules = Message<"buf.validate.RepeatedRules"> & {
|
|
|
3483
3615
|
maxItems: bigint;
|
|
3484
3616
|
/**
|
|
3485
3617
|
* `unique` indicates that all elements in this field must
|
|
3486
|
-
* be unique. This
|
|
3618
|
+
* be unique. This rule is strictly applicable to scalar and enum
|
|
3487
3619
|
* types, with message types not being supported.
|
|
3488
3620
|
*
|
|
3489
3621
|
* ```proto
|
|
@@ -3497,13 +3629,13 @@ export type RepeatedRules = Message<"buf.validate.RepeatedRules"> & {
|
|
|
3497
3629
|
*/
|
|
3498
3630
|
unique: boolean;
|
|
3499
3631
|
/**
|
|
3500
|
-
* `items` details the
|
|
3632
|
+
* `items` details the rules to be applied to each item
|
|
3501
3633
|
* in the field. Even for repeated message fields, validation is executed
|
|
3502
|
-
* against each item unless
|
|
3634
|
+
* against each item unless `ignore` is specified.
|
|
3503
3635
|
*
|
|
3504
3636
|
* ```proto
|
|
3505
3637
|
* message MyRepeated {
|
|
3506
|
-
* // The items in the field `value` must follow the specified
|
|
3638
|
+
* // The items in the field `value` must follow the specified rules.
|
|
3507
3639
|
* repeated string value = 1 [(buf.validate.field).repeated.items = {
|
|
3508
3640
|
* string: {
|
|
3509
3641
|
* min_len: 3
|
|
@@ -3513,9 +3645,12 @@ export type RepeatedRules = Message<"buf.validate.RepeatedRules"> & {
|
|
|
3513
3645
|
* }
|
|
3514
3646
|
* ```
|
|
3515
3647
|
*
|
|
3516
|
-
*
|
|
3648
|
+
* Note that the `required` rule does not apply. Repeated items
|
|
3649
|
+
* cannot be unset.
|
|
3650
|
+
*
|
|
3651
|
+
* @generated from field: optional buf.validate.FieldRules items = 4;
|
|
3517
3652
|
*/
|
|
3518
|
-
items?:
|
|
3653
|
+
items?: FieldRules;
|
|
3519
3654
|
};
|
|
3520
3655
|
/**
|
|
3521
3656
|
* Describes the message buf.validate.RepeatedRules.
|
|
@@ -3523,7 +3658,7 @@ export type RepeatedRules = Message<"buf.validate.RepeatedRules"> & {
|
|
|
3523
3658
|
*/
|
|
3524
3659
|
export declare const RepeatedRulesSchema: GenMessage<RepeatedRules>;
|
|
3525
3660
|
/**
|
|
3526
|
-
* MapRules describe the
|
|
3661
|
+
* MapRules describe the rules applied to `map` values.
|
|
3527
3662
|
*
|
|
3528
3663
|
* @generated from message buf.validate.MapRules
|
|
3529
3664
|
*/
|
|
@@ -3557,11 +3692,11 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
|
|
|
3557
3692
|
*/
|
|
3558
3693
|
maxPairs: bigint;
|
|
3559
3694
|
/**
|
|
3560
|
-
* Specifies the
|
|
3695
|
+
* Specifies the rules to be applied to each key in the field.
|
|
3561
3696
|
*
|
|
3562
3697
|
* ```proto
|
|
3563
3698
|
* message MyMap {
|
|
3564
|
-
* // The keys in the field `value` must follow the specified
|
|
3699
|
+
* // The keys in the field `value` must follow the specified rules.
|
|
3565
3700
|
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
|
|
3566
3701
|
* string: {
|
|
3567
3702
|
* min_len: 3
|
|
@@ -3571,17 +3706,19 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
|
|
|
3571
3706
|
* }
|
|
3572
3707
|
* ```
|
|
3573
3708
|
*
|
|
3574
|
-
*
|
|
3709
|
+
* Note that the `required` rule does not apply. Map keys cannot be unset.
|
|
3710
|
+
*
|
|
3711
|
+
* @generated from field: optional buf.validate.FieldRules keys = 4;
|
|
3575
3712
|
*/
|
|
3576
|
-
keys?:
|
|
3713
|
+
keys?: FieldRules;
|
|
3577
3714
|
/**
|
|
3578
|
-
* Specifies the
|
|
3715
|
+
* Specifies the rules to be applied to the value of each key in the
|
|
3579
3716
|
* field. Message values will still have their validations evaluated unless
|
|
3580
|
-
*
|
|
3717
|
+
* `ignore` is specified.
|
|
3581
3718
|
*
|
|
3582
3719
|
* ```proto
|
|
3583
3720
|
* message MyMap {
|
|
3584
|
-
* // The values in the field `value` must follow the specified
|
|
3721
|
+
* // The values in the field `value` must follow the specified rules.
|
|
3585
3722
|
* map<string, string> value = 1 [(buf.validate.field).map.values = {
|
|
3586
3723
|
* string: {
|
|
3587
3724
|
* min_len: 5
|
|
@@ -3590,10 +3727,11 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
|
|
|
3590
3727
|
* }];
|
|
3591
3728
|
* }
|
|
3592
3729
|
* ```
|
|
3730
|
+
* Note that the `required` rule does not apply. Map values cannot be unset.
|
|
3593
3731
|
*
|
|
3594
|
-
* @generated from field: optional buf.validate.
|
|
3732
|
+
* @generated from field: optional buf.validate.FieldRules values = 5;
|
|
3595
3733
|
*/
|
|
3596
|
-
values?:
|
|
3734
|
+
values?: FieldRules;
|
|
3597
3735
|
};
|
|
3598
3736
|
/**
|
|
3599
3737
|
* Describes the message buf.validate.MapRules.
|
|
@@ -3601,7 +3739,7 @@ export type MapRules = Message<"buf.validate.MapRules"> & {
|
|
|
3601
3739
|
*/
|
|
3602
3740
|
export declare const MapRulesSchema: GenMessage<MapRules>;
|
|
3603
3741
|
/**
|
|
3604
|
-
* AnyRules describe
|
|
3742
|
+
* AnyRules describe rules applied exclusively to the `google.protobuf.Any` well-known type.
|
|
3605
3743
|
*
|
|
3606
3744
|
* @generated from message buf.validate.AnyRules
|
|
3607
3745
|
*/
|
|
@@ -3614,7 +3752,9 @@ export type AnyRules = Message<"buf.validate.AnyRules"> & {
|
|
|
3614
3752
|
* ```proto
|
|
3615
3753
|
* message MyAny {
|
|
3616
3754
|
* // The `value` field must have a `type_url` equal to one of the specified values.
|
|
3617
|
-
* google.protobuf.Any value = 1 [(buf.validate.field).any
|
|
3755
|
+
* google.protobuf.Any value = 1 [(buf.validate.field).any = {
|
|
3756
|
+
* in: ["type.googleapis.com/MyType1", "type.googleapis.com/MyType2"]
|
|
3757
|
+
* }];
|
|
3618
3758
|
* }
|
|
3619
3759
|
* ```
|
|
3620
3760
|
*
|
|
@@ -3626,8 +3766,10 @@ export type AnyRules = Message<"buf.validate.AnyRules"> & {
|
|
|
3626
3766
|
*
|
|
3627
3767
|
* ```proto
|
|
3628
3768
|
* message MyAny {
|
|
3629
|
-
* //
|
|
3630
|
-
* google.protobuf.Any value = 1 [(buf.validate.field).any
|
|
3769
|
+
* // The `value` field must not have a `type_url` equal to any of the specified values.
|
|
3770
|
+
* google.protobuf.Any value = 1 [(buf.validate.field).any = {
|
|
3771
|
+
* not_in: ["type.googleapis.com/ForbiddenType1", "type.googleapis.com/ForbiddenType2"]
|
|
3772
|
+
* }];
|
|
3631
3773
|
* }
|
|
3632
3774
|
* ```
|
|
3633
3775
|
*
|
|
@@ -3641,7 +3783,7 @@ export type AnyRules = Message<"buf.validate.AnyRules"> & {
|
|
|
3641
3783
|
*/
|
|
3642
3784
|
export declare const AnyRulesSchema: GenMessage<AnyRules>;
|
|
3643
3785
|
/**
|
|
3644
|
-
* DurationRules describe the
|
|
3786
|
+
* DurationRules describe the rules applied exclusively to the `google.protobuf.Duration` well-known type.
|
|
3645
3787
|
*
|
|
3646
3788
|
* @generated from message buf.validate.DurationRules
|
|
3647
3789
|
*/
|
|
@@ -3792,7 +3934,7 @@ export type DurationRules = Message<"buf.validate.DurationRules"> & {
|
|
|
3792
3934
|
notIn: Duration[];
|
|
3793
3935
|
/**
|
|
3794
3936
|
* `example` specifies values that the field may have. These values SHOULD
|
|
3795
|
-
* conform to other
|
|
3937
|
+
* conform to other rules. `example` values will not impact validation
|
|
3796
3938
|
* but may be used as helpful guidance on how to populate the given field.
|
|
3797
3939
|
*
|
|
3798
3940
|
* ```proto
|
|
@@ -3814,7 +3956,7 @@ export type DurationRules = Message<"buf.validate.DurationRules"> & {
|
|
|
3814
3956
|
*/
|
|
3815
3957
|
export declare const DurationRulesSchema: GenMessage<DurationRules>;
|
|
3816
3958
|
/**
|
|
3817
|
-
* TimestampRules describe the
|
|
3959
|
+
* TimestampRules describe the rules applied exclusively to the `google.protobuf.Timestamp` well-known type.
|
|
3818
3960
|
*
|
|
3819
3961
|
* @generated from message buf.validate.TimestampRules
|
|
3820
3962
|
*/
|
|
@@ -3970,6 +4112,19 @@ export type TimestampRules = Message<"buf.validate.TimestampRules"> & {
|
|
|
3970
4112
|
*/
|
|
3971
4113
|
within?: Duration;
|
|
3972
4114
|
/**
|
|
4115
|
+
* `example` specifies values that the field may have. These values SHOULD
|
|
4116
|
+
* conform to other rules. `example` values will not impact validation
|
|
4117
|
+
* but may be used as helpful guidance on how to populate the given field.
|
|
4118
|
+
*
|
|
4119
|
+
* ```proto
|
|
4120
|
+
* message MyTimestamp {
|
|
4121
|
+
* google.protobuf.Timestamp value = 1 [
|
|
4122
|
+
* (buf.validate.field).timestamp.example = { seconds: 1672444800 },
|
|
4123
|
+
* (buf.validate.field).timestamp.example = { seconds: 1672531200 },
|
|
4124
|
+
* ];
|
|
4125
|
+
* }
|
|
4126
|
+
* ```
|
|
4127
|
+
*
|
|
3973
4128
|
* @generated from field: repeated google.protobuf.Timestamp example = 10;
|
|
3974
4129
|
*/
|
|
3975
4130
|
example: Timestamp[];
|
|
@@ -3981,7 +4136,7 @@ export type TimestampRules = Message<"buf.validate.TimestampRules"> & {
|
|
|
3981
4136
|
export declare const TimestampRulesSchema: GenMessage<TimestampRules>;
|
|
3982
4137
|
/**
|
|
3983
4138
|
* `Violations` is a collection of `Violation` messages. This message type is returned by
|
|
3984
|
-
*
|
|
4139
|
+
* Protovalidate when a proto message fails to meet the requirements set by the `Rule` validation rules.
|
|
3985
4140
|
* Each individual violation is represented by a `Violation` message.
|
|
3986
4141
|
*
|
|
3987
4142
|
* @generated from message buf.validate.Violations
|
|
@@ -4001,15 +4156,46 @@ export type Violations = Message<"buf.validate.Violations"> & {
|
|
|
4001
4156
|
export declare const ViolationsSchema: GenMessage<Violations>;
|
|
4002
4157
|
/**
|
|
4003
4158
|
* `Violation` represents a single instance where a validation rule, expressed
|
|
4004
|
-
* as a `
|
|
4005
|
-
* caused the violation, the specific
|
|
4159
|
+
* as a `Rule`, was not met. It provides information about the field that
|
|
4160
|
+
* caused the violation, the specific rule that wasn't fulfilled, and a
|
|
4006
4161
|
* human-readable error message.
|
|
4007
4162
|
*
|
|
4163
|
+
* For example, consider the following message:
|
|
4164
|
+
*
|
|
4165
|
+
* ```proto
|
|
4166
|
+
* message User {
|
|
4167
|
+
* int32 age = 1 [(buf.validate.field).cel = {
|
|
4168
|
+
* id: "user.age",
|
|
4169
|
+
* expression: "this < 18 ? 'User must be at least 18 years old' : ''",
|
|
4170
|
+
* }];
|
|
4171
|
+
* }
|
|
4172
|
+
* ```
|
|
4173
|
+
*
|
|
4174
|
+
* It could produce the following violation:
|
|
4175
|
+
*
|
|
4008
4176
|
* ```json
|
|
4009
4177
|
* {
|
|
4010
|
-
* "
|
|
4011
|
-
* "
|
|
4012
|
-
* "
|
|
4178
|
+
* "ruleId": "user.age",
|
|
4179
|
+
* "message": "User must be at least 18 years old",
|
|
4180
|
+
* "field": {
|
|
4181
|
+
* "elements": [
|
|
4182
|
+
* {
|
|
4183
|
+
* "fieldNumber": 1,
|
|
4184
|
+
* "fieldName": "age",
|
|
4185
|
+
* "fieldType": "TYPE_INT32"
|
|
4186
|
+
* }
|
|
4187
|
+
* ]
|
|
4188
|
+
* },
|
|
4189
|
+
* "rule": {
|
|
4190
|
+
* "elements": [
|
|
4191
|
+
* {
|
|
4192
|
+
* "fieldNumber": 23,
|
|
4193
|
+
* "fieldName": "cel",
|
|
4194
|
+
* "fieldType": "TYPE_MESSAGE",
|
|
4195
|
+
* "index": "0"
|
|
4196
|
+
* }
|
|
4197
|
+
* ]
|
|
4198
|
+
* }
|
|
4013
4199
|
* }
|
|
4014
4200
|
* ```
|
|
4015
4201
|
*
|
|
@@ -4041,9 +4227,9 @@ export type Violation = Message<"buf.validate.Violation"> & {
|
|
|
4041
4227
|
*/
|
|
4042
4228
|
field?: FieldPath;
|
|
4043
4229
|
/**
|
|
4044
|
-
* `rule` is a machine-readable path that points to the specific
|
|
4045
|
-
* This will be a nested field starting from the
|
|
4046
|
-
* For custom
|
|
4230
|
+
* `rule` is a machine-readable path that points to the specific rule that failed validation.
|
|
4231
|
+
* This will be a nested field starting from the FieldRules of the field that failed validation.
|
|
4232
|
+
* For custom rules, this will provide the path of the rule, e.g. `cel[0]`.
|
|
4047
4233
|
*
|
|
4048
4234
|
* For example, consider the following message:
|
|
4049
4235
|
*
|
|
@@ -4051,7 +4237,7 @@ export type Violation = Message<"buf.validate.Violation"> & {
|
|
|
4051
4237
|
* message Message {
|
|
4052
4238
|
* bool a = 1 [(buf.validate.field).required = true];
|
|
4053
4239
|
* bool b = 2 [(buf.validate.field).cel = {
|
|
4054
|
-
* id: "
|
|
4240
|
+
* id: "custom_rule",
|
|
4055
4241
|
* expression: "!this ? 'b must be true': ''"
|
|
4056
4242
|
* }]
|
|
4057
4243
|
* }
|
|
@@ -4074,15 +4260,15 @@ export type Violation = Message<"buf.validate.Violation"> & {
|
|
|
4074
4260
|
*/
|
|
4075
4261
|
rule?: FieldPath;
|
|
4076
4262
|
/**
|
|
4077
|
-
* `
|
|
4078
|
-
* This is the same `id` that was specified in the `
|
|
4263
|
+
* `rule_id` is the unique identifier of the `Rule` that was not fulfilled.
|
|
4264
|
+
* This is the same `id` that was specified in the `Rule` message, allowing easy tracing of which rule was violated.
|
|
4079
4265
|
*
|
|
4080
|
-
* @generated from field: optional string
|
|
4266
|
+
* @generated from field: optional string rule_id = 2;
|
|
4081
4267
|
*/
|
|
4082
|
-
|
|
4268
|
+
ruleId: string;
|
|
4083
4269
|
/**
|
|
4084
4270
|
* `message` is a human-readable error message that describes the nature of the violation.
|
|
4085
|
-
* This can be the default error message from the violated `
|
|
4271
|
+
* 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.
|
|
4086
4272
|
*
|
|
4087
4273
|
* @generated from field: optional string message = 3;
|
|
4088
4274
|
*/
|
|
@@ -4229,157 +4415,96 @@ export type FieldPathElement = Message<"buf.validate.FieldPathElement"> & {
|
|
|
4229
4415
|
*/
|
|
4230
4416
|
export declare const FieldPathElementSchema: GenMessage<FieldPathElement>;
|
|
4231
4417
|
/**
|
|
4232
|
-
* Specifies how
|
|
4233
|
-
*
|
|
4418
|
+
* Specifies how `FieldRules.ignore` behaves, depending on the field's value, and
|
|
4419
|
+
* whether the field tracks presence.
|
|
4234
4420
|
*
|
|
4235
4421
|
* @generated from enum buf.validate.Ignore
|
|
4236
4422
|
*/
|
|
4237
4423
|
export declare enum Ignore {
|
|
4238
4424
|
/**
|
|
4239
|
-
*
|
|
4425
|
+
* Ignore rules if the field tracks presence and is unset. This is the default
|
|
4426
|
+
* behavior.
|
|
4427
|
+
*
|
|
4428
|
+
* In proto3, only message fields, members of a Protobuf `oneof`, and fields
|
|
4429
|
+
* with the `optional` label track presence. Consequently, the following fields
|
|
4430
|
+
* are always validated, whether a value is set or not:
|
|
4240
4431
|
*
|
|
4241
4432
|
* ```proto
|
|
4242
4433
|
* syntax="proto3";
|
|
4243
4434
|
*
|
|
4244
|
-
* message
|
|
4245
|
-
*
|
|
4246
|
-
*
|
|
4247
|
-
* (buf.validate.field).string.uri = true
|
|
4435
|
+
* message RulesApply {
|
|
4436
|
+
* string email = 1 [
|
|
4437
|
+
* (buf.validate.field).string.email = true
|
|
4248
4438
|
* ];
|
|
4249
|
-
*
|
|
4250
|
-
*
|
|
4251
|
-
* // set to the empty string.
|
|
4252
|
-
* optional string bar = 2 [
|
|
4253
|
-
* (buf.validate.field).string.uri = true
|
|
4439
|
+
* int32 age = 2 [
|
|
4440
|
+
* (buf.validate.field).int32.gt = 0
|
|
4254
4441
|
* ];
|
|
4255
|
-
*
|
|
4256
|
-
*
|
|
4257
|
-
* repeated string baz = 3 [
|
|
4258
|
-
* (buf.validate.field).repeated.min_items = 3
|
|
4259
|
-
* ];
|
|
4260
|
-
*
|
|
4261
|
-
* // The custom CEL rule applies only if the field is set, including if
|
|
4262
|
-
* // it's the "zero" value of that message.
|
|
4263
|
-
* SomeMessage quux = 4 [
|
|
4264
|
-
* (buf.validate.field).cel = {/* ... *\/}
|
|
4442
|
+
* repeated string labels = 3 [
|
|
4443
|
+
* (buf.validate.field).repeated.min_items = 1
|
|
4265
4444
|
* ];
|
|
4266
4445
|
* }
|
|
4267
4446
|
* ```
|
|
4268
4447
|
*
|
|
4269
|
-
*
|
|
4270
|
-
|
|
4271
|
-
UNSPECIFIED = 0,
|
|
4272
|
-
/**
|
|
4273
|
-
* Validation is skipped if the field is unpopulated. This rule is redundant
|
|
4274
|
-
* if the field is already nullable.
|
|
4448
|
+
* In contrast, the following fields track presence, and are only validated if
|
|
4449
|
+
* a value is set:
|
|
4275
4450
|
*
|
|
4276
4451
|
* ```proto
|
|
4277
|
-
* syntax="proto3
|
|
4278
|
-
*
|
|
4279
|
-
* message Request {
|
|
4280
|
-
* // The uri rule applies only if the value is not the empty string.
|
|
4281
|
-
* string foo = 1 [
|
|
4282
|
-
* (buf.validate.field).string.uri = true,
|
|
4283
|
-
* (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
|
|
4284
|
-
* ];
|
|
4285
|
-
*
|
|
4286
|
-
* // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this
|
|
4287
|
-
* // case: the uri rule only applies if the field is set, including if
|
|
4288
|
-
* // it's set to the empty string.
|
|
4289
|
-
* optional string bar = 2 [
|
|
4290
|
-
* (buf.validate.field).string.uri = true,
|
|
4291
|
-
* (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
|
|
4292
|
-
* ];
|
|
4452
|
+
* syntax="proto3";
|
|
4293
4453
|
*
|
|
4294
|
-
*
|
|
4295
|
-
*
|
|
4296
|
-
* (buf.validate.field).
|
|
4297
|
-
* (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
|
|
4454
|
+
* message RulesApplyIfSet {
|
|
4455
|
+
* optional string email = 1 [
|
|
4456
|
+
* (buf.validate.field).string.email = true
|
|
4298
4457
|
* ];
|
|
4299
|
-
*
|
|
4300
|
-
*
|
|
4301
|
-
*
|
|
4302
|
-
*
|
|
4303
|
-
*
|
|
4304
|
-
*
|
|
4305
|
-
*
|
|
4458
|
+
* oneof ref {
|
|
4459
|
+
* string reference = 2 [
|
|
4460
|
+
* (buf.validate.field).string.uuid = true
|
|
4461
|
+
* ];
|
|
4462
|
+
* string name = 3 [
|
|
4463
|
+
* (buf.validate.field).string.min_len = 4
|
|
4464
|
+
* ];
|
|
4465
|
+
* }
|
|
4466
|
+
* SomeMessage msg = 4 [
|
|
4467
|
+
* (buf.validate.field).cel = {/* ... *\/}
|
|
4306
4468
|
* ];
|
|
4307
4469
|
* }
|
|
4308
4470
|
* ```
|
|
4309
4471
|
*
|
|
4310
|
-
*
|
|
4311
|
-
*/
|
|
4312
|
-
IF_UNPOPULATED = 1,
|
|
4313
|
-
/**
|
|
4314
|
-
* Validation is skipped if the field is unpopulated or if it is a nullable
|
|
4315
|
-
* field populated with its default value. This is typically the zero or
|
|
4316
|
-
* empty value, but proto2 scalars support custom defaults. For messages, the
|
|
4317
|
-
* default is a non-null message with all its fields unpopulated.
|
|
4472
|
+
* To ensure that such a field is set, add the `required` rule.
|
|
4318
4473
|
*
|
|
4319
|
-
*
|
|
4320
|
-
*
|
|
4321
|
-
*
|
|
4322
|
-
* message Request {
|
|
4323
|
-
* // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in
|
|
4324
|
-
* // this case; the uri rule applies only if the value is not the empty
|
|
4325
|
-
* // string.
|
|
4326
|
-
* string foo = 1 [
|
|
4327
|
-
* (buf.validate.field).string.uri = true,
|
|
4328
|
-
* (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
|
|
4329
|
-
* ];
|
|
4330
|
-
*
|
|
4331
|
-
* // The uri rule only applies if the field is set to a value other than
|
|
4332
|
-
* // the empty string.
|
|
4333
|
-
* optional string bar = 2 [
|
|
4334
|
-
* (buf.validate.field).string.uri = true,
|
|
4335
|
-
* (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
|
|
4336
|
-
* ];
|
|
4337
|
-
*
|
|
4338
|
-
* // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in
|
|
4339
|
-
* // this case; the min_items rule only applies if the list has at least
|
|
4340
|
-
* // one item.
|
|
4341
|
-
* repeated string baz = 3 [
|
|
4342
|
-
* (buf.validate.field).repeated.min_items = 3,
|
|
4343
|
-
* (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
|
|
4344
|
-
* ];
|
|
4474
|
+
* To learn which fields track presence, see the
|
|
4475
|
+
* [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
|
|
4345
4476
|
*
|
|
4346
|
-
*
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
*
|
|
4351
|
-
* ];
|
|
4352
|
-
* }
|
|
4353
|
-
* ```
|
|
4477
|
+
* @generated from enum value: IGNORE_UNSPECIFIED = 0;
|
|
4478
|
+
*/
|
|
4479
|
+
UNSPECIFIED = 0,
|
|
4480
|
+
/**
|
|
4481
|
+
* Ignore rules if the field is unset, or set to the zero value.
|
|
4354
4482
|
*
|
|
4355
|
-
*
|
|
4483
|
+
* The zero value depends on the field type:
|
|
4484
|
+
* - For strings, the zero value is the empty string.
|
|
4485
|
+
* - For bytes, the zero value is empty bytes.
|
|
4486
|
+
* - For bool, the zero value is false.
|
|
4487
|
+
* - For numeric types, the zero value is zero.
|
|
4488
|
+
* - For enums, the zero value is the first defined enum value.
|
|
4489
|
+
* - For repeated fields, the zero is an empty list.
|
|
4490
|
+
* - For map fields, the zero is an empty map.
|
|
4491
|
+
* - For message fields, absence of the message (typically a null-value) is considered zero value.
|
|
4356
4492
|
*
|
|
4357
|
-
*
|
|
4358
|
-
*
|
|
4359
|
-
*
|
|
4360
|
-
* message Request {
|
|
4361
|
-
* // The gt rule only applies if the field is set and it's value is not
|
|
4362
|
-
* the default (i.e., not -42). The rule even applies if the field is set
|
|
4363
|
-
* to zero since the default value differs.
|
|
4364
|
-
* optional int32 value = 1 [
|
|
4365
|
-
* default = -42,
|
|
4366
|
-
* (buf.validate.field).int32.gt = 0,
|
|
4367
|
-
* (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
|
|
4368
|
-
* ];
|
|
4369
|
-
* }
|
|
4493
|
+
* For fields that track presence (e.g. adding the `optional` label in proto3),
|
|
4494
|
+
* this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`.
|
|
4370
4495
|
*
|
|
4371
|
-
* @generated from enum value:
|
|
4496
|
+
* @generated from enum value: IGNORE_IF_ZERO_VALUE = 1;
|
|
4372
4497
|
*/
|
|
4373
|
-
|
|
4498
|
+
IF_ZERO_VALUE = 1,
|
|
4374
4499
|
/**
|
|
4375
|
-
*
|
|
4376
|
-
*
|
|
4377
|
-
*
|
|
4378
|
-
* temporarily
|
|
4500
|
+
* Always ignore rules, including the `required` rule.
|
|
4501
|
+
*
|
|
4502
|
+
* This is useful for ignoring the rules of a referenced message, or to
|
|
4503
|
+
* temporarily ignore rules during development.
|
|
4379
4504
|
*
|
|
4380
4505
|
* ```proto
|
|
4381
4506
|
* message MyMessage {
|
|
4382
|
-
* // The field's rules will always be ignored, including any
|
|
4507
|
+
* // The field's rules will always be ignored, including any validations
|
|
4383
4508
|
* // on value's fields.
|
|
4384
4509
|
* MyOtherMessage value = 1 [
|
|
4385
4510
|
* (buf.validate.field).ignore = IGNORE_ALWAYS];
|
|
@@ -4395,7 +4520,7 @@ export declare enum Ignore {
|
|
|
4395
4520
|
*/
|
|
4396
4521
|
export declare const IgnoreSchema: GenEnum<Ignore>;
|
|
4397
4522
|
/**
|
|
4398
|
-
*
|
|
4523
|
+
* KnownRegex contains some well-known patterns.
|
|
4399
4524
|
*
|
|
4400
4525
|
* @generated from enum buf.validate.KnownRegex
|
|
4401
4526
|
*/
|
|
@@ -4405,13 +4530,13 @@ export declare enum KnownRegex {
|
|
|
4405
4530
|
*/
|
|
4406
4531
|
UNSPECIFIED = 0,
|
|
4407
4532
|
/**
|
|
4408
|
-
* HTTP header name as defined by [RFC 7230](https://
|
|
4533
|
+
* HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2).
|
|
4409
4534
|
*
|
|
4410
4535
|
* @generated from enum value: KNOWN_REGEX_HTTP_HEADER_NAME = 1;
|
|
4411
4536
|
*/
|
|
4412
4537
|
HTTP_HEADER_NAME = 1,
|
|
4413
4538
|
/**
|
|
4414
|
-
* HTTP header value as defined by [RFC 7230](https://
|
|
4539
|
+
* HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4).
|
|
4415
4540
|
*
|
|
4416
4541
|
* @generated from enum value: KNOWN_REGEX_HTTP_HEADER_VALUE = 2;
|
|
4417
4542
|
*/
|
|
@@ -4425,25 +4550,25 @@ export declare const KnownRegexSchema: GenEnum<KnownRegex>;
|
|
|
4425
4550
|
* Rules specify the validations to be performed on this message. By default,
|
|
4426
4551
|
* no validation is performed against a message.
|
|
4427
4552
|
*
|
|
4428
|
-
* @generated from extension: optional buf.validate.
|
|
4553
|
+
* @generated from extension: optional buf.validate.MessageRules message = 1159;
|
|
4429
4554
|
*/
|
|
4430
|
-
export declare const message: GenExtension<MessageOptions,
|
|
4555
|
+
export declare const message: GenExtension<MessageOptions, MessageRules>;
|
|
4431
4556
|
/**
|
|
4432
4557
|
* Rules specify the validations to be performed on this oneof. By default,
|
|
4433
4558
|
* no validation is performed against a oneof.
|
|
4434
4559
|
*
|
|
4435
|
-
* @generated from extension: optional buf.validate.
|
|
4560
|
+
* @generated from extension: optional buf.validate.OneofRules oneof = 1159;
|
|
4436
4561
|
*/
|
|
4437
|
-
export declare const oneof: GenExtension<OneofOptions,
|
|
4562
|
+
export declare const oneof: GenExtension<OneofOptions, OneofRules>;
|
|
4438
4563
|
/**
|
|
4439
4564
|
* Rules specify the validations to be performed on this field. By default,
|
|
4440
4565
|
* no validation is performed against a field.
|
|
4441
4566
|
*
|
|
4442
|
-
* @generated from extension: optional buf.validate.
|
|
4567
|
+
* @generated from extension: optional buf.validate.FieldRules field = 1159;
|
|
4443
4568
|
*/
|
|
4444
|
-
export declare const field: GenExtension<FieldOptions,
|
|
4569
|
+
export declare const field: GenExtension<FieldOptions, FieldRules>;
|
|
4445
4570
|
/**
|
|
4446
|
-
* Specifies predefined rules. When extending a standard
|
|
4571
|
+
* Specifies predefined rules. When extending a standard rule message,
|
|
4447
4572
|
* this adds additional CEL expressions that apply when the extension is used.
|
|
4448
4573
|
*
|
|
4449
4574
|
* ```proto
|
|
@@ -4460,7 +4585,7 @@ export declare const field: GenExtension<FieldOptions, FieldConstraints>;
|
|
|
4460
4585
|
* }
|
|
4461
4586
|
* ```
|
|
4462
4587
|
*
|
|
4463
|
-
* @generated from extension: optional buf.validate.
|
|
4588
|
+
* @generated from extension: optional buf.validate.PredefinedRules predefined = 1160;
|
|
4464
4589
|
*/
|
|
4465
|
-
export declare const predefined: GenExtension<FieldOptions,
|
|
4590
|
+
export declare const predefined: GenExtension<FieldOptions, PredefinedRules>;
|
|
4466
4591
|
//# sourceMappingURL=validate_pb.d.ts.map
|