Skip to content

Commit dbcb51f

Browse files
committed
Migrate proto validation from protoc-gen-validate to protovalidate
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent bdd35ce commit dbcb51f

File tree

159 files changed

+410
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+410
-412
lines changed

api/contrib/envoy/extensions/filters/http/golang/v3alpha/golang.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ message Config {
8787

8888
message RouterPlugin {
8989
oneof override {
90-
option (validate.required) = true;
90+
option (buf.validate.oneof).required = true;
9191

9292
// [#not-implemented-hide:]
9393
// Disable the filter for this particular vhost or route.

api/contrib/envoy/extensions/filters/http/sxg/v3alpha/sxg.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ message SXG {
5151
// Header that will be set if it is determined that the client can accept SXG (typically ``accept: application/signed-exchange;v=b3``)
5252
// If not set, filter will default to: ``x-client-can-accept-sxg``
5353
string client_can_accept_sxg_header = 7 [
54-
(buf.validate.field).string = {well_known_regex: HTTP_HEADER_NAME strict: false ignore_empty: true}
54+
(buf.validate.field).string = {well_known_regex: KNOWN_REGEX_HTTP_HEADER_NAME strict: false}
5555
];
5656

5757
// Header set by downstream service to signal that the response should be transformed to SXG If not set,
5858
// filter will default to: ``x-should-encode-sxg``
5959
string should_encode_sxg_header = 8 [
60-
(buf.validate.field).string = {well_known_regex: HTTP_HEADER_NAME strict: false ignore_empty: true}
60+
(buf.validate.field).string = {well_known_regex: KNOWN_REGEX_HTTP_HEADER_NAME strict: false}
6161
];
6262

6363
// Headers that will be stripped from the SXG document, by listing a prefix (i.e. ``x-custom-`` will cause
6464
// all headers prefixed by ``x-custom-`` to be omitted from the SXG document)
6565
repeated string header_prefix_filters = 9 [
66-
(buf.validate.field).repeated = {items {string {well_known_regex: HTTP_HEADER_NAME strict: false}}}
66+
(buf.validate.field).repeated = {items {string {well_known_regex: KNOWN_REGEX_HTTP_HEADER_NAME strict: false}}}
6767
];
6868
}

api/contrib/envoy/extensions/filters/network/client_ssl_auth/v3/client_ssl_auth.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ message ClientSSLAuth {
3131
// of principals. The service must support the expected :ref:`REST API
3232
// <config_network_filters_client_ssl_auth_rest_api>`.
3333
string auth_api_cluster = 1
34-
[(buf.validate.field).string = {min_len: 1 well_known_regex: HTTP_HEADER_VALUE strict: false}];
34+
[(buf.validate.field).string = {min_len: 1 well_known_regex: KNOWN_REGEX_HTTP_HEADER_VALUE strict: false}];
3535

3636
// The prefix to use when emitting :ref:`statistics
3737
// <config_network_filters_client_ssl_auth_stats>`.

api/contrib/envoy/extensions/filters/network/sip_proxy/v3alpha/route.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ message Route {
3232

3333
message RouteMatch {
3434
oneof match_specifier {
35-
option (validate.required) = true;
35+
option (buf.validate.oneof).required = true;
3636

3737
// The domain from Request URI or Route Header.
3838
string domain = 1;
@@ -47,7 +47,7 @@ message RouteMatch {
4747

4848
message RouteAction {
4949
oneof cluster_specifier {
50-
option (validate.required) = true;
50+
option (buf.validate.oneof).required = true;
5151

5252
// Indicates a single upstream cluster to which the request should be routed
5353
// to.

api/contrib/envoy/extensions/private_key_providers/cryptomb/v3alpha/cryptomb.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ message CryptoMbPrivateKeyMethodConfig {
3838
// already in the queue are processed, even if the queue is not full.
3939
// In effect, this value controls the balance between latency and
4040
// throughput. The duration needs to be set to a value greater than or equal to 1 millisecond.
41-
google.protobuf.Duration poll_delay = 2 [(buf.validate.field).duration = {
42-
required: true
43-
gte {nanos: 1000000}
44-
}];
41+
google.protobuf.Duration poll_delay = 2 [
42+
(buf.validate.field).required = true,
43+
(buf.validate.field).duration = {gte {nanos: 1000000}}
44+
];
4545
}

api/contrib/envoy/extensions/private_key_providers/qat/v3alpha/qat.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ message QatPrivateKeyMethodConfig {
3333
// quicker answers from the hardware but causes more polling loop
3434
// spins, leading to potentially larger CPU usage. The duration needs
3535
// to be set to a value greater than or equal to 1 millisecond.
36-
google.protobuf.Duration poll_delay = 2 [(buf.validate.field).duration = {
37-
required: true
38-
gte {nanos: 1000000}
39-
}];
36+
google.protobuf.Duration poll_delay = 2 [
37+
(buf.validate.field).required = true,
38+
(buf.validate.field).duration = {gte {nanos: 1000000}}
39+
];
4040
}

api/envoy/api/v2/cluster.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,10 @@ message Cluster {
461461
// Specifies the base interval between refreshes. This parameter is required and must be greater
462462
// than zero and less than
463463
// :ref:`max_interval <envoy_api_field_Cluster.RefreshRate.max_interval>`.
464-
google.protobuf.Duration base_interval = 1 [(buf.validate.field).duration = {
465-
required: true
466-
gt {nanos: 1000000}
467-
}];
464+
google.protobuf.Duration base_interval = 1 [
465+
(buf.validate.field).required = true,
466+
(buf.validate.field).duration = {gt {nanos: 1000000}}
467+
];
468468

469469
// Specifies the maximum interval between refreshes. This parameter is optional, but must be
470470
// greater than or equal to the

api/envoy/api/v2/core/address.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ message SocketAddress {
5353
string address = 2 [(buf.validate.field).string = {min_bytes: 1}];
5454

5555
oneof port_specifier {
56-
option (validate.required) = true;
56+
option (buf.validate.oneof).required = true;
5757

5858
uint32 port_value = 3 [(buf.validate.field).uint32 = {lte: 65535}];
5959

@@ -116,7 +116,7 @@ message BindConfig {
116116
// management servers.
117117
message Address {
118118
oneof address {
119-
option (validate.required) = true;
119+
option (buf.validate.oneof).required = true;
120120

121121
SocketAddress socket_address = 1;
122122

api/envoy/api/v2/core/backoff.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ message BackoffStrategy {
2222
// The base interval to be used for the next back off computation. It should
2323
// be greater than zero and less than or equal to :ref:`max_interval
2424
// <envoy_api_field_core.BackoffStrategy.max_interval>`.
25-
google.protobuf.Duration base_interval = 1 [(buf.validate.field).duration = {
26-
required: true
27-
gte {nanos: 1000000}
28-
}];
25+
google.protobuf.Duration base_interval = 1 [
26+
(buf.validate.field).required = true,
27+
(buf.validate.field).duration = {gte {nanos: 1000000}}
28+
];
2929

3030
// Specifies the maximum interval between retries. This parameter is optional,
3131
// but must be greater than or equal to the :ref:`base_interval

api/envoy/api/v2/core/base.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,15 @@ message HeaderValue {
257257
// Header name.
258258
string key = 1
259259
[(buf.validate.field).string =
260-
{min_bytes: 1 max_bytes: 16384 well_known_regex: HTTP_HEADER_NAME strict: false}];
260+
{min_bytes: 1 max_bytes: 16384 well_known_regex: KNOWN_REGEX_HTTP_HEADER_NAME strict: false}];
261261

262262
// Header value.
263263
//
264264
// The same :ref:`format specifier <config_access_log_format>` as used for
265265
// :ref:`HTTP access logging <config_access_log>` applies here, however
266266
// unknown header values are replaced with the empty string instead of `-`.
267267
string value = 2 [
268-
(buf.validate.field).string = {max_bytes: 16384 well_known_regex: HTTP_HEADER_VALUE strict: false}
268+
(buf.validate.field).string = {max_bytes: 16384 well_known_regex: KNOWN_REGEX_HTTP_HEADER_VALUE strict: false}
269269
];
270270
}
271271

@@ -287,7 +287,7 @@ message HeaderMap {
287287
// Data source consisting of either a file or an inline value.
288288
message DataSource {
289289
oneof specifier {
290-
option (validate.required) = true;
290+
option (buf.validate.oneof).required = true;
291291

292292
// Local filesystem data source.
293293
string filename = 1 [(buf.validate.field).string = {min_bytes: 1}];
@@ -327,7 +327,7 @@ message RemoteDataSource {
327327
// Async data source which support async data fetch.
328328
message AsyncDataSource {
329329
oneof specifier {
330-
option (validate.required) = true;
330+
option (buf.validate.oneof).required = true;
331331

332332
// Local async data source.
333333
DataSource local = 1;

0 commit comments

Comments
 (0)