@devvit/protos 0.11.7-next-2025-02-10-fe279479a.0 → 0.11.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. package/package.json +4 -4
  2. package/meta.min.json +0 -7820
  3. package/protos.min.js +0 -2
  4. package/protos.min.js.map +0 -7
  5. package/schema/.snootobuf/deps/buf/validate/expression.proto +0 -92
  6. package/schema/.snootobuf/deps/buf/validate/priv/private.proto +0 -41
  7. package/schema/.snootobuf/deps/buf/validate/validate.proto +0 -4130
  8. package/schema/.snootobuf/deps/devvit/data/api/admin/v1alpha/audit.proto +0 -72
  9. package/schema/.snootobuf/deps/devvit/data/api/admin/v1alpha/auth.proto +0 -49
  10. package/schema/.snootobuf/deps/devvit/data/api/admin/v1alpha/organization.proto +0 -54
  11. package/schema/.snootobuf/deps/devvit/data/api/admin/v1alpha/service.proto +0 -46
  12. package/schema/.snootobuf/deps/devvit/data/api/admin/v1alpha/subscription.proto +0 -72
  13. package/schema/.snootobuf/deps/devvit/data/api/admin/v1alpha/ui.proto +0 -20
  14. package/schema/.snootobuf/deps/devvit/data/api/admin/v1alpha/user.proto +0 -45
  15. package/schema/.snootobuf/deps/devvit/data/api/v1alpha/admin.proto +0 -54
  16. package/schema/.snootobuf/deps/devvit/data/api/v1alpha/delivery.proto +0 -773
  17. package/schema/.snootobuf/deps/devvit/data/api/v1alpha/filter.proto +0 -66
  18. package/schema/.snootobuf/deps/devvit/data/api/v1alpha/firehose.proto +0 -100
  19. package/schema/.snootobuf/deps/devvit/data/api/v1alpha/intake.proto +0 -19
  20. package/schema/.snootobuf/deps/devvit/events/v1alpha/events.proto +0 -446
  21. package/schema/.snootobuf/deps/devvit/gateway/v1alpha/payments.proto +0 -24
  22. package/schema/.snootobuf/deps/devvit/options/options.proto +0 -98
  23. package/schema/.snootobuf/deps/devvit/reddit/v2alpha/commentv2.proto +0 -29
  24. package/schema/.snootobuf/deps/devvit/reddit/v2alpha/flair.proto +0 -25
  25. package/schema/.snootobuf/deps/devvit/reddit/v2alpha/modaction.proto +0 -53
  26. package/schema/.snootobuf/deps/devvit/reddit/v2alpha/modmail.proto +0 -56
  27. package/schema/.snootobuf/deps/devvit/reddit/v2alpha/postv2.proto +0 -107
  28. package/schema/.snootobuf/deps/devvit/reddit/v2alpha/subredditv2.proto +0 -41
  29. package/schema/.snootobuf/deps/devvit/reddit/v2alpha/userv2.proto +0 -23
  30. package/schema/.snootobuf/deps/devvit/triggers/v1alpha/triggers.proto +0 -162
  31. package/schema/.snootobuf/deps/enum/account_gender_category.proto +0 -14
  32. package/schema/.snootobuf/deps/enum/approval_status.proto +0 -15
  33. package/schema/.snootobuf/deps/enum/automated_reporting_level.proto +0 -12
  34. package/schema/.snootobuf/deps/enum/ban_evasion_threshold.proto +0 -13
  35. package/schema/.snootobuf/deps/enum/ban_info_action.proto +0 -12
  36. package/schema/.snootobuf/deps/enum/block_relation_type.proto +0 -11
  37. package/schema/.snootobuf/deps/enum/comment_sort.proto +0 -18
  38. package/schema/.snootobuf/deps/enum/comment_type.proto +0 -11
  39. package/schema/.snootobuf/deps/enum/crowd_control_level.proto +0 -12
  40. package/schema/.snootobuf/deps/enum/discussion_type.proto +0 -10
  41. package/schema/.snootobuf/deps/enum/distinguish_type.proto +0 -14
  42. package/schema/.snootobuf/deps/enum/flair_position.proto +0 -11
  43. package/schema/.snootobuf/deps/enum/hateful_content_threshold.proto +0 -12
  44. package/schema/.snootobuf/deps/enum/link_content_type.proto +0 -11
  45. package/schema/.snootobuf/deps/enum/link_type.proto +0 -11
  46. package/schema/.snootobuf/deps/enum/link_visibility.proto +0 -11
  47. package/schema/.snootobuf/deps/enum/prediction_leaderboard_entry_type.proto +0 -11
  48. package/schema/.snootobuf/deps/enum/promo_layout.proto +0 -11
  49. package/schema/.snootobuf/deps/enum/removed_by_type.proto +0 -18
  50. package/schema/.snootobuf/deps/enum/spam_level.proto +0 -11
  51. package/schema/.snootobuf/deps/enum/subreddit_type.proto +0 -16
  52. package/schema/.snootobuf/deps/enum/verdict.proto +0 -14
  53. package/schema/.snootobuf/deps/enum/vote.proto +0 -12
  54. package/schema/.snootobuf/deps/enum/whitelist_status.proto +0 -17
  55. package/schema/.snootobuf/deps/enum/wiki_edit_mode.proto +0 -12
  56. package/schema/.snootobuf/deps/evaluator/evaluator.proto +0 -203
  57. package/schema/.snootobuf/deps/google/api/annotations.proto +0 -31
  58. package/schema/.snootobuf/deps/google/api/apikeys/v2/apikeys.proto +0 -288
  59. package/schema/.snootobuf/deps/google/api/apikeys/v2/resources.proto +0 -175
  60. package/schema/.snootobuf/deps/google/api/auth.proto +0 -237
  61. package/schema/.snootobuf/deps/google/api/backend.proto +0 -185
  62. package/schema/.snootobuf/deps/google/api/billing.proto +0 -77
  63. package/schema/.snootobuf/deps/google/api/client.proto +0 -431
  64. package/schema/.snootobuf/deps/google/api/cloudquotas/v1/cloudquotas.proto +0 -322
  65. package/schema/.snootobuf/deps/google/api/cloudquotas/v1/resources.proto +0 -315
  66. package/schema/.snootobuf/deps/google/api/config_change.proto +0 -84
  67. package/schema/.snootobuf/deps/google/api/consumer.proto +0 -82
  68. package/schema/.snootobuf/deps/google/api/context.proto +0 -92
  69. package/schema/.snootobuf/deps/google/api/control.proto +0 -41
  70. package/schema/.snootobuf/deps/google/api/distribution.proto +0 -213
  71. package/schema/.snootobuf/deps/google/api/documentation.proto +0 -168
  72. package/schema/.snootobuf/deps/google/api/endpoint.proto +0 -69
  73. package/schema/.snootobuf/deps/google/api/error_reason.proto +0 -589
  74. package/schema/.snootobuf/deps/google/api/expr/conformance/v1alpha1/conformance_service.proto +0 -183
  75. package/schema/.snootobuf/deps/google/api/expr/v1alpha1/checked.proto +0 -343
  76. package/schema/.snootobuf/deps/google/api/expr/v1alpha1/eval.proto +0 -118
  77. package/schema/.snootobuf/deps/google/api/expr/v1alpha1/explain.proto +0 -53
  78. package/schema/.snootobuf/deps/google/api/expr/v1alpha1/syntax.proto +0 -438
  79. package/schema/.snootobuf/deps/google/api/expr/v1alpha1/value.proto +0 -115
  80. package/schema/.snootobuf/deps/google/api/expr/v1beta1/decl.proto +0 -84
  81. package/schema/.snootobuf/deps/google/api/expr/v1beta1/eval.proto +0 -125
  82. package/schema/.snootobuf/deps/google/api/expr/v1beta1/expr.proto +0 -265
  83. package/schema/.snootobuf/deps/google/api/expr/v1beta1/source.proto +0 -62
  84. package/schema/.snootobuf/deps/google/api/expr/v1beta1/value.proto +0 -114
  85. package/schema/.snootobuf/deps/google/api/field_behavior.proto +0 -104
  86. package/schema/.snootobuf/deps/google/api/field_info.proto +0 -106
  87. package/schema/.snootobuf/deps/google/api/http.proto +0 -371
  88. package/schema/.snootobuf/deps/google/api/httpbody.proto +0 -81
  89. package/schema/.snootobuf/deps/google/api/label.proto +0 -48
  90. package/schema/.snootobuf/deps/google/api/launch_stage.proto +0 -72
  91. package/schema/.snootobuf/deps/google/api/log.proto +0 -54
  92. package/schema/.snootobuf/deps/google/api/logging.proto +0 -81
  93. package/schema/.snootobuf/deps/google/api/metric.proto +0 -268
  94. package/schema/.snootobuf/deps/google/api/monitored_resource.proto +0 -130
  95. package/schema/.snootobuf/deps/google/api/monitoring.proto +0 -107
  96. package/schema/.snootobuf/deps/google/api/policy.proto +0 -85
  97. package/schema/.snootobuf/deps/google/api/quota.proto +0 -184
  98. package/schema/.snootobuf/deps/google/api/resource.proto +0 -243
  99. package/schema/.snootobuf/deps/google/api/routing.proto +0 -461
  100. package/schema/.snootobuf/deps/google/api/service.proto +0 -191
  101. package/schema/.snootobuf/deps/google/api/servicecontrol/v1/check_error.proto +0 -124
  102. package/schema/.snootobuf/deps/google/api/servicecontrol/v1/distribution.proto +0 -166
  103. package/schema/.snootobuf/deps/google/api/servicecontrol/v1/http_request.proto +0 -93
  104. package/schema/.snootobuf/deps/google/api/servicecontrol/v1/log_entry.proto +0 -126
  105. package/schema/.snootobuf/deps/google/api/servicecontrol/v1/metric_value.proto +0 -81
  106. package/schema/.snootobuf/deps/google/api/servicecontrol/v1/operation.proto +0 -123
  107. package/schema/.snootobuf/deps/google/api/servicecontrol/v1/quota_controller.proto +0 -245
  108. package/schema/.snootobuf/deps/google/api/servicecontrol/v1/service_controller.proto +0 -260
  109. package/schema/.snootobuf/deps/google/api/servicecontrol/v2/service_controller.proto +0 -196
  110. package/schema/.snootobuf/deps/google/api/servicemanagement/v1/resources.proto +0 -295
  111. package/schema/.snootobuf/deps/google/api/servicemanagement/v1/servicemanager.proto +0 -508
  112. package/schema/.snootobuf/deps/google/api/serviceusage/v1/resources.proto +0 -130
  113. package/schema/.snootobuf/deps/google/api/serviceusage/v1/serviceusage.proto +0 -305
  114. package/schema/.snootobuf/deps/google/api/serviceusage/v1beta1/resources.proto +0 -458
  115. package/schema/.snootobuf/deps/google/api/serviceusage/v1beta1/serviceusage.proto +0 -793
  116. package/schema/.snootobuf/deps/google/api/source_info.proto +0 -31
  117. package/schema/.snootobuf/deps/google/api/system_parameter.proto +0 -96
  118. package/schema/.snootobuf/deps/google/api/usage.proto +0 -96
  119. package/schema/.snootobuf/deps/google/api/visibility.proto +0 -113
  120. package/schema/.snootobuf/deps/google/cloud/extended_operations.proto +0 -150
  121. package/schema/.snootobuf/deps/google/iam/admin/v1/iam.proto +0 -1087
  122. package/schema/.snootobuf/deps/google/iam/v1/iam_policy.proto +0 -145
  123. package/schema/.snootobuf/deps/google/iam/v1/logging/audit_data.proto +0 -34
  124. package/schema/.snootobuf/deps/google/iam/v1/options.proto +0 -41
  125. package/schema/.snootobuf/deps/google/iam/v1/policy.proto +0 -240
  126. package/schema/.snootobuf/deps/google/logging/type/http_request.proto +0 -92
  127. package/schema/.snootobuf/deps/google/logging/type/log_severity.proto +0 -72
  128. package/schema/.snootobuf/deps/google/longrunning/operations.proto +0 -247
  129. package/schema/.snootobuf/deps/google/protobuf/any.proto +0 -158
  130. package/schema/.snootobuf/deps/google/protobuf/api.proto +0 -208
  131. package/schema/.snootobuf/deps/google/protobuf/compiler/plugin.proto +0 -183
  132. package/schema/.snootobuf/deps/google/protobuf/descriptor.proto +0 -921
  133. package/schema/.snootobuf/deps/google/protobuf/duration.proto +0 -116
  134. package/schema/.snootobuf/deps/google/protobuf/empty.proto +0 -51
  135. package/schema/.snootobuf/deps/google/protobuf/field_mask.proto +0 -245
  136. package/schema/.snootobuf/deps/google/protobuf/source_context.proto +0 -48
  137. package/schema/.snootobuf/deps/google/protobuf/struct.proto +0 -95
  138. package/schema/.snootobuf/deps/google/protobuf/timestamp.proto +0 -147
  139. package/schema/.snootobuf/deps/google/protobuf/type.proto +0 -187
  140. package/schema/.snootobuf/deps/google/protobuf/wrappers.proto +0 -123
  141. package/schema/.snootobuf/deps/google/rpc/code.proto +0 -186
  142. package/schema/.snootobuf/deps/google/rpc/context/attribute_context.proto +0 -287
  143. package/schema/.snootobuf/deps/google/rpc/error_details.proto +0 -246
  144. package/schema/.snootobuf/deps/google/rpc/status.proto +0 -47
  145. package/schema/.snootobuf/deps/google/type/calendar_period.proto +0 -57
  146. package/schema/.snootobuf/deps/google/type/color.proto +0 -170
  147. package/schema/.snootobuf/deps/google/type/date.proto +0 -50
  148. package/schema/.snootobuf/deps/google/type/datetime.proto +0 -97
  149. package/schema/.snootobuf/deps/google/type/dayofweek.proto +0 -51
  150. package/schema/.snootobuf/deps/google/type/expr.proto +0 -51
  151. package/schema/.snootobuf/deps/google/type/fraction.proto +0 -34
  152. package/schema/.snootobuf/deps/google/type/latlng.proto +0 -37
  153. package/schema/.snootobuf/deps/google/type/money.proto +0 -43
  154. package/schema/.snootobuf/deps/google/type/month.proto +0 -66
  155. package/schema/.snootobuf/deps/google/type/postal_address.proto +0 -135
  156. package/schema/.snootobuf/deps/google/type/quaternion.proto +0 -95
  157. package/schema/.snootobuf/deps/google/type/timeofday.proto +0 -44
  158. package/schema/.snootobuf/deps/openapi/helper.proto +0 -20
  159. package/schema/.snootobuf/deps/products-api/protos/reddit/xpaymentsplatform/payproducts/v1/currencies.proto +0 -189
  160. package/schema/.snootobuf/deps/products-api/protos/reddit/xpaymentsplatform/payproducts/v1/payproducts.proto +0 -118
  161. package/schema/.snootobuf/deps/reddit/api/metadata/v1/metadata.proto +0 -55
  162. package/schema/.snootobuf/deps/reddit/coreplatform/account/v1/account.proto +0 -579
  163. package/schema/.snootobuf/deps/reddit/coreplatform/account/v1/account_relations.proto +0 -43
  164. package/schema/.snootobuf/deps/reddit/coreplatform/api/metadata/v1/metadata.proto +0 -82
  165. package/schema/.snootobuf/deps/reddit/coreplatform/blocking/v1/user_blocking_service.proto +0 -221
  166. package/schema/.snootobuf/deps/reddit/coreplatform/comments/v1/comment_tree.proto +0 -78
  167. package/schema/.snootobuf/deps/reddit/coreplatform/comments/v1/comment_tree_service.proto +0 -189
  168. package/schema/.snootobuf/deps/reddit/coreplatform/comments/v1/comment_tree_structure.proto +0 -29
  169. package/schema/.snootobuf/deps/reddit/coreplatform/comments/v1/comments.proto +0 -417
  170. package/schema/.snootobuf/deps/reddit/coreplatform/comments/v1/comments_service.proto +0 -72
  171. package/schema/.snootobuf/deps/reddit/coreplatform/common/v1/auth.proto +0 -25
  172. package/schema/.snootobuf/deps/reddit/coreplatform/common/v1/features.proto +0 -52
  173. package/schema/.snootobuf/deps/reddit/coreplatform/common/v1/lang.proto +0 -16
  174. package/schema/.snootobuf/deps/reddit/coreplatform/common/v1/legal.proto +0 -20
  175. package/schema/.snootobuf/deps/reddit/coreplatform/common/v1/media.proto +0 -149
  176. package/schema/.snootobuf/deps/reddit/coreplatform/common/v1/moderation.proto +0 -197
  177. package/schema/.snootobuf/deps/reddit/coreplatform/common/v1/safety.proto +0 -116
  178. package/schema/.snootobuf/deps/reddit/coreplatform/common/v1/time.proto +0 -25
  179. package/schema/.snootobuf/deps/reddit/coreplatform/domains/v1/domains_metadata_service.proto +0 -101
  180. package/schema/.snootobuf/deps/reddit/coreplatform/grpc_thrift/v1/grpc_thrift_options.proto +0 -34
  181. package/schema/.snootobuf/deps/reddit/coreplatform/links/v1/links.proto +0 -798
  182. package/schema/.snootobuf/deps/reddit/coreplatform/links/v1/links_service.proto +0 -186
  183. package/schema/.snootobuf/deps/reddit/coreplatform/messages/v1/messages.proto +0 -110
  184. package/schema/.snootobuf/deps/reddit/coreplatform/sensitive/v1/wrappers.proto +0 -51
  185. package/schema/.snootobuf/deps/reddit/coreplatform/subreddit/v1/subreddit.proto +0 -1202
  186. package/schema/.snootobuf/deps/reddit/coreplatform/subreddit/v1/subreddit_member_relations.proto +0 -85
  187. package/schema/.snootobuf/deps/reddit/coreplatform/subreddit/v1/subreddit_moderator_service.proto +0 -363
  188. package/schema/.snootobuf/deps/reddit/coreplatform/subreddit/v1/subreddit_service.proto +0 -301
  189. package/schema/.snootobuf/deps/reddit/coreplatform/thing/v0/thing.proto +0 -2869
  190. package/schema/.snootobuf/deps/reddit/devvit/custom_post/v1/custom_post.proto +0 -15
  191. package/schema/.snootobuf/deps/reddit/devvit/custom_post/v1/service.proto +0 -11
  192. package/schema/.snootobuf/deps/reddit/devvit/subreddit/v1/context_action.proto +0 -48
  193. package/schema/.snootobuf/deps/reddit/devvit/subreddit/v1/manifest.proto +0 -70
  194. package/schema/.snootobuf/deps/reddit/devvit/subreddit/v1/service.proto +0 -11
  195. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/acknowledge_order_delivery.proto +0 -17
  196. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/checkout.proto +0 -89
  197. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/common.proto +0 -322
  198. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/delete_products.proto +0 -17
  199. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/events.proto +0 -14
  200. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/get_batch_products.proto +0 -15
  201. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/get_gold_balances.proto +0 -48
  202. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/get_order.proto +0 -31
  203. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/get_orders.proto +0 -26
  204. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/get_orders_by_user.proto +0 -15
  205. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/get_payout_info_batch.proto +0 -52
  206. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/get_products.proto +0 -23
  207. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/get_user_profiles.proto +0 -28
  208. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/refund_order.proto +0 -17
  209. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/service.proto +0 -49
  210. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/service_data_compliance.proto +0 -20
  211. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payapi/v1/upsert_products.proto +0 -17
  212. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/paygatewaypsps/v1/paygatewaypsps.proto +0 -158
  213. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payorders/v1/payments_data_compliance.proto +0 -18
  214. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payorders/v1/payorders.proto +0 -195
  215. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/paypayments/v1/admin.proto +0 -44
  216. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/paypayments/v1/ledger.proto +0 -200
  217. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/paypayments/v1/payments_data_compliance.proto +0 -18
  218. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/paypayments/v1/paypayments.proto +0 -210
  219. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payproducts/v1/currencies.proto +0 -189
  220. package/schema/.snootobuf/deps/reddit/xpaymentsplatform/payproducts/v1/payproducts.proto +0 -135
  221. package/schema/.snootobuf/deps/snooron_sources/text_classification/text_classification.proto +0 -29
  222. package/schema/.snootobuf/deps/snooron_sources/v2_event/v2_event.proto +0 -3292
  223. package/schema/.snootobuf/deps/validate/validate.proto +0 -862
@@ -1,4130 +0,0 @@
1
- // Copyright 2023 Buf Technologies, Inc.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- syntax = "proto3";
16
-
17
- package buf.validate;
18
-
19
- import "buf/validate/expression.proto";
20
- import "buf/validate/priv/private.proto";
21
- import "google/protobuf/descriptor.proto";
22
- import "google/protobuf/duration.proto";
23
- import "google/protobuf/timestamp.proto";
24
-
25
- option go_package = "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate";
26
- option java_multiple_files = true;
27
- option java_outer_classname = "ValidateProto";
28
- option java_package = "build.buf.validate";
29
-
30
- // MessageOptions is an extension to google.protobuf.MessageOptions. It allows
31
- // the addition of validation rules at the message level. These rules can be
32
- // applied to incoming messages to ensure they meet certain criteria before
33
- // being processed.
34
- extend google.protobuf.MessageOptions {
35
- // Rules specify the validations to be performed on this message. By default,
36
- // no validation is performed against a message.
37
- optional MessageConstraints message = 1159;
38
- }
39
-
40
- // OneofOptions is an extension to google.protobuf.OneofOptions. It allows
41
- // the addition of validation rules on a oneof. These rules can be
42
- // applied to incoming messages to ensure they meet certain criteria before
43
- // being processed.
44
- extend google.protobuf.OneofOptions {
45
- // Rules specify the validations to be performed on this oneof. By default,
46
- // no validation is performed against a oneof.
47
- optional OneofConstraints oneof = 1159;
48
- }
49
-
50
- // FieldOptions is an extension to google.protobuf.FieldOptions. It allows
51
- // the addition of validation rules at the field level. These rules can be
52
- // applied to incoming messages to ensure they meet certain criteria before
53
- // being processed.
54
- extend google.protobuf.FieldOptions {
55
- // Rules specify the validations to be performed on this field. By default,
56
- // no validation is performed against a field.
57
- optional FieldConstraints field = 1159;
58
- }
59
-
60
- // MessageConstraints represents validation rules that are applied to the entire message.
61
- // It includes disabling options and a list of Constraint messages representing Common Expression Language (CEL) validation rules.
62
- message MessageConstraints {
63
- // `disabled` is a boolean flag that, when set to true, nullifies any validation rules for this message.
64
- // This includes any fields within the message that would otherwise support validation.
65
- //
66
- // ```proto
67
- // message MyMessage {
68
- // // validation will be bypassed for this message
69
- // option (buf.validate.message).disabled = true;
70
- // }
71
- // ```
72
- optional bool disabled = 1;
73
-
74
- // `cel` is a repeated field of type Constraint. Each Constraint specifies a validation rule to be applied to this message.
75
- // These constraints are written in Common Expression Language (CEL) syntax. For more information on
76
- // CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
77
- //
78
- //
79
- // ```proto
80
- // message MyMessage {
81
- // // The field `foo` must be greater than 42.
82
- // option (buf.validate.message).cel = {
83
- // id: "my_message.value",
84
- // message: "value must be greater than 42",
85
- // expression: "this.foo > 42",
86
- // };
87
- // optional int32 foo = 1;
88
- // }
89
- // ```
90
- repeated Constraint cel = 3;
91
- }
92
-
93
- // The `OneofConstraints` message type enables you to manage constraints for
94
- // oneof fields in your protobuf messages.
95
- message OneofConstraints {
96
- // If `required` is true, exactly one field of the oneof must be present. A
97
- // validation error is returned if no fields in the oneof are present. The
98
- // field itself may still be a default value; further constraints
99
- // should be placed on the fields themselves to ensure they are valid values,
100
- // such as `min_len` or `gt`.
101
- //
102
- // ```proto
103
- // message MyMessage {
104
- // oneof value {
105
- // // Either `a` or `b` must be set. If `a` is set, it must also be
106
- // // non-empty; whereas if `b` is set, it can still be an empty string.
107
- // option (buf.validate.oneof).required = true;
108
- // string a = 1 [(buf.validate.field).string.min_len = 1];
109
- // string b = 2;
110
- // }
111
- // }
112
- // ```
113
- optional bool required = 1;
114
- }
115
-
116
- // FieldConstraints encapsulates the rules for each type of field. Depending on
117
- // the field, the correct set should be used to ensure proper validations.
118
- message FieldConstraints {
119
- // `cel` is a repeated field used to represent a textual expression
120
- // in the Common Expression Language (CEL) syntax. For more information on
121
- // CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
122
- //
123
- // ```proto
124
- // message MyMessage {
125
- // // The field `value` must be greater than 42.
126
- // optional int32 value = 1 [(buf.validate.field).cel = {
127
- // id: "my_message.value",
128
- // message: "value must be greater than 42",
129
- // expression: "this > 42",
130
- // }];
131
- // }
132
- // ```
133
- repeated Constraint cel = 23;
134
- // If `required` is true, the field must be populated. A populated field can be
135
- // described as "serialized in the wire format," which includes:
136
- //
137
- // - the following "nullable" fields must be explicitly set to be considered populated:
138
- // - singular message fields (whose fields may be unpopulated/default values)
139
- // - member fields of a oneof (may be their default value)
140
- // - proto3 optional fields (may be their default value)
141
- // - proto2 scalar fields (both optional and required)
142
- // - proto3 scalar fields must be non-zero to be considered populated
143
- // - repeated and map fields must be non-empty to be considered populated
144
- //
145
- // ```proto
146
- // message MyMessage {
147
- // // The field `value` must be set to a non-null value.
148
- // optional MyOtherMessage value = 1 [(buf.validate.field).required = true];
149
- // }
150
- // ```
151
- bool required = 25;
152
- // Skip validation on the field if its value matches the specified criteria.
153
- // See Ignore enum for details.
154
- //
155
- // ```proto
156
- // message UpdateRequest {
157
- // // The uri rule only applies if the field is populated and not an empty
158
- // // string.
159
- // optional string url = 1 [
160
- // (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE,
161
- // (buf.validate.field).string.uri = true,
162
- // ];
163
- // }
164
- // ```
165
- Ignore ignore = 27;
166
-
167
- oneof type {
168
- // Scalar Field Types
169
- FloatRules float = 1;
170
- DoubleRules double = 2;
171
- Int32Rules int32 = 3;
172
- Int64Rules int64 = 4;
173
- UInt32Rules uint32 = 5;
174
- UInt64Rules uint64 = 6;
175
- SInt32Rules sint32 = 7;
176
- SInt64Rules sint64 = 8;
177
- Fixed32Rules fixed32 = 9;
178
- Fixed64Rules fixed64 = 10;
179
- SFixed32Rules sfixed32 = 11;
180
- SFixed64Rules sfixed64 = 12;
181
- BoolRules bool = 13;
182
- StringRules string = 14;
183
- BytesRules bytes = 15;
184
-
185
- // Complex Field Types
186
- EnumRules enum = 16;
187
- RepeatedRules repeated = 18;
188
- MapRules map = 19;
189
-
190
- // Well-Known Field Types
191
- AnyRules any = 20;
192
- DurationRules duration = 21;
193
- TimestampRules timestamp = 22;
194
- }
195
-
196
- // DEPRECATED: use ignore=IGNORE_ALWAYS instead. TODO: remove this field pre-v1.
197
- bool skipped = 24 [deprecated = true];
198
- // DEPRECATED: use ignore=IGNORE_IF_UNPOPULATED instead. TODO: remove this field pre-v1.
199
- bool ignore_empty = 26 [deprecated = true];
200
- }
201
-
202
- // Specifies how FieldConstraints.ignore behaves. See the documentation for
203
- // FieldConstraints.required for definitions of "populated" and "nullable".
204
- enum Ignore {
205
- // buf:lint:ignore ENUM_NO_ALLOW_ALIAS // allowance for deprecations. TODO: remove pre-v1.
206
- option allow_alias = true;
207
- // Validation is only skipped if it's an unpopulated nullable fields.
208
- //
209
- // ```proto
210
- // syntax="proto3";
211
- //
212
- // message Request {
213
- // // The uri rule applies to any value, including the empty string.
214
- // string foo = 1 [
215
- // (buf.validate.field).string.uri = true
216
- // ];
217
- //
218
- // // The uri rule only applies if the field is set, including if it's
219
- // // set to the empty string.
220
- // optional string bar = 2 [
221
- // (buf.validate.field).string.uri = true
222
- // ];
223
- //
224
- // // The min_items rule always applies, even if the list is empty.
225
- // repeated string baz = 3 [
226
- // (buf.validate.field).repeated.min_items = 3
227
- // ];
228
- //
229
- // // The custom CEL rule applies only if the field is set, including if
230
- // // it's the "zero" value of that message.
231
- // SomeMessage quux = 4 [
232
- // (buf.validate.field).cel = {/* ... */}
233
- // ];
234
- // }
235
- // ```
236
- IGNORE_UNSPECIFIED = 0;
237
-
238
- // Validation is skipped if the field is unpopulated. This rule is redundant
239
- // if the field is already nullable. This value is equivalent behavior to the
240
- // deprecated ignore_empty rule.
241
- //
242
- // ```proto
243
- // syntax="proto3
244
- //
245
- // message Request {
246
- // // The uri rule applies only if the value is not the empty string.
247
- // string foo = 1 [
248
- // (buf.validate.field).string.uri = true,
249
- // (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
250
- // ];
251
- //
252
- // // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this
253
- // // case: the uri rule only applies if the field is set, including if
254
- // // it's set to the empty string.
255
- // optional string bar = 2 [
256
- // (buf.validate.field).string.uri = true,
257
- // (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
258
- // ];
259
- //
260
- // // The min_items rule only applies if the list has at least one item.
261
- // repeated string baz = 3 [
262
- // (buf.validate.field).repeated.min_items = 3,
263
- // (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
264
- // ];
265
- //
266
- // // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this
267
- // // case: the custom CEL rule applies only if the field is set, including
268
- // // if it's the "zero" value of that message.
269
- // SomeMessage quux = 4 [
270
- // (buf.validate.field).cel = {/* ... */},
271
- // (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
272
- // ];
273
- // }
274
- // ```
275
- IGNORE_IF_UNPOPULATED = 1;
276
-
277
- // Validation is skipped if the field is unpopulated or if it is a nullable
278
- // field populated with its default value. This is typically the zero or
279
- // empty value, but proto2 scalars support custom defaults. For messages, the
280
- // default is a non-null message with all its fields unpopulated.
281
- //
282
- // ```proto
283
- // syntax="proto3
284
- //
285
- // message Request {
286
- // // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in
287
- // // this case; the uri rule applies only if the value is not the empty
288
- // // string.
289
- // string foo = 1 [
290
- // (buf.validate.field).string.uri = true,
291
- // (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
292
- // ];
293
- //
294
- // // The uri rule only applies if the field is set to a value other than
295
- // // the empty string.
296
- // optional string bar = 2 [
297
- // (buf.validate.field).string.uri = true,
298
- // (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
299
- // ];
300
- //
301
- // // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in
302
- // // this case; the min_items rule only applies if the list has at least
303
- // // one item.
304
- // repeated string baz = 3 [
305
- // (buf.validate.field).repeated.min_items = 3,
306
- // (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
307
- // ];
308
- //
309
- // // The custom CEL rule only applies if the field is set to a value other
310
- // // than an empty message (i.e., fields are unpopulated).
311
- // SomeMessage quux = 4 [
312
- // (buf.validate.field).cel = {/* ... */},
313
- // (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
314
- // ];
315
- // }
316
- // ```
317
- //
318
- // This rule is affected by proto2 custom default values:
319
- //
320
- // ```proto
321
- // syntax="proto2";
322
- //
323
- // message Request {
324
- // // The gt rule only applies if the field is set and it's value is not
325
- // the default (i.e., not -42). The rule even applies if the field is set
326
- // to zero since the default value differs.
327
- // optional int32 value = 1 [
328
- // default = -42,
329
- // (buf.validate.field).int32.gt = 0,
330
- // (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE
331
- // ];
332
- // }
333
- IGNORE_IF_DEFAULT_VALUE = 2;
334
-
335
- // The validation rules of this field will be skipped and not evaluated. This
336
- // is useful for situations that necessitate turning off the rules of a field
337
- // containing a message that may not make sense in the current context, or to
338
- // temporarily disable constraints during development.
339
- //
340
- // ```proto
341
- // message MyMessage {
342
- // // The field's rules will always be ignored, including any validation's
343
- // // on value's fields.
344
- // MyOtherMessage value = 1 [
345
- // (buf.validate.field).ignore = IGNORE_ALWAYS];
346
- // }
347
- // ```
348
- IGNORE_ALWAYS = 3;
349
-
350
- // Deprecated: Use IGNORE_IF_UNPOPULATED instead. TODO: Remove this value pre-v1.
351
- IGNORE_EMPTY = 1 [deprecated = true];
352
- // Deprecated: Use IGNORE_IF_DEFAULT_VALUE. TODO: Remove this value pre-v1.
353
- IGNORE_DEFAULT = 2 [deprecated = true];
354
- }
355
-
356
- // FloatRules describes the constraints applied to `float` values. These
357
- // rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type.
358
- message FloatRules {
359
- // `const` requires the field value to exactly match the specified value. If
360
- // the field value doesn't match, an error message is generated.
361
- //
362
- // ```proto
363
- // message MyFloat {
364
- // // value must equal 42.0
365
- // float value = 1 [(buf.validate.field).float.const = 42.0];
366
- // }
367
- // ```
368
- optional float const = 1 [(priv.field).cel = {
369
- id: "float.const"
370
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
371
- }];
372
-
373
- oneof less_than {
374
- // `lt` requires the field value to be less than the specified value (field <
375
- // value). If the field value is equal to or greater than the specified value,
376
- // an error message is generated.
377
- //
378
- // ```proto
379
- // message MyFloat {
380
- // // value must be less than 10.0
381
- // float value = 1 [(buf.validate.field).float.lt = 10.0];
382
- // }
383
- // ```
384
- float lt = 2 [(priv.field).cel = {
385
- id: "float.lt"
386
- expression:
387
- "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this >= rules.lt)"
388
- "? 'value must be less than %s'.format([rules.lt]) : ''"
389
- }];
390
-
391
- // `lte` requires the field value to be less than or equal to the specified
392
- // value (field <= value). If the field value is greater than the specified
393
- // value, an error message is generated.
394
- //
395
- // ```proto
396
- // message MyFloat {
397
- // // value must be less than or equal to 10.0
398
- // float value = 1 [(buf.validate.field).float.lte = 10.0];
399
- // }
400
- // ```
401
- float lte = 3 [(priv.field).cel = {
402
- id: "float.lte"
403
- expression:
404
- "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this > rules.lte)"
405
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
406
- }];
407
- }
408
-
409
- oneof greater_than {
410
- // `gt` requires the field value to be greater than the specified value
411
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
412
- // `lte`, the range is reversed, and the field value must be outside the
413
- // specified range. If the field value doesn't meet the required conditions,
414
- // an error message is generated.
415
- //
416
- // ```proto
417
- // message MyFloat {
418
- // // value must be greater than 5.0 [float.gt]
419
- // float value = 1 [(buf.validate.field).float.gt = 5.0];
420
- //
421
- // // value must be greater than 5 and less than 10.0 [float.gt_lt]
422
- // float other_value = 2 [(buf.validate.field).float = { gt: 5.0, lt: 10.0 }];
423
- //
424
- // // value must be greater than 10 or less than 5.0 [float.gt_lt_exclusive]
425
- // float another_value = 3 [(buf.validate.field).float = { gt: 10.0, lt: 5.0 }];
426
- // }
427
- // ```
428
- float gt = 4 [
429
- (priv.field).cel = {
430
- id: "float.gt"
431
- expression:
432
- "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this <= rules.gt)"
433
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
434
- },
435
- (priv.field).cel = {
436
- id: "float.gt_lt"
437
- expression:
438
- "has(rules.lt) && rules.lt >= rules.gt && (this.isNan() || this >= rules.lt || this <= rules.gt)"
439
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
440
- },
441
- (priv.field).cel = {
442
- id: "float.gt_lt_exclusive"
443
- expression:
444
- "has(rules.lt) && rules.lt < rules.gt && (this.isNan() || (rules.lt <= this && this <= rules.gt))"
445
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
446
- },
447
- (priv.field).cel = {
448
- id: "float.gt_lte"
449
- expression:
450
- "has(rules.lte) && rules.lte >= rules.gt && (this.isNan() || this > rules.lte || this <= rules.gt)"
451
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
452
- },
453
- (priv.field).cel = {
454
- id: "float.gt_lte_exclusive"
455
- expression:
456
- "has(rules.lte) && rules.lte < rules.gt && (this.isNan() || (rules.lte < this && this <= rules.gt))"
457
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
458
- }
459
- ];
460
-
461
- // `gte` requires the field value to be greater than or equal to the specified
462
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
463
- // or `lte`, the range is reversed, and the field value must be outside the
464
- // specified range. If the field value doesn't meet the required conditions,
465
- // an error message is generated.
466
- //
467
- // ```proto
468
- // message MyFloat {
469
- // // value must be greater than or equal to 5.0 [float.gte]
470
- // float value = 1 [(buf.validate.field).float.gte = 5.0];
471
- //
472
- // // value must be greater than or equal to 5.0 and less than 10.0 [float.gte_lt]
473
- // float other_value = 2 [(buf.validate.field).float = { gte: 5.0, lt: 10.0 }];
474
- //
475
- // // value must be greater than or equal to 10.0 or less than 5.0 [float.gte_lt_exclusive]
476
- // float another_value = 3 [(buf.validate.field).float = { gte: 10.0, lt: 5.0 }];
477
- // }
478
- // ```
479
- float gte = 5 [
480
- (priv.field).cel = {
481
- id: "float.gte"
482
- expression:
483
- "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this < rules.gte)"
484
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
485
- },
486
- (priv.field).cel = {
487
- id: "float.gte_lt"
488
- expression:
489
- "has(rules.lt) && rules.lt >= rules.gte && (this.isNan() || this >= rules.lt || this < rules.gte)"
490
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
491
- },
492
- (priv.field).cel = {
493
- id: "float.gte_lt_exclusive"
494
- expression:
495
- "has(rules.lt) && rules.lt < rules.gte && (this.isNan() || (rules.lt <= this && this < rules.gte))"
496
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
497
- },
498
- (priv.field).cel = {
499
- id: "float.gte_lte"
500
- expression:
501
- "has(rules.lte) && rules.lte >= rules.gte && (this.isNan() || this > rules.lte || this < rules.gte)"
502
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
503
- },
504
- (priv.field).cel = {
505
- id: "float.gte_lte_exclusive"
506
- expression:
507
- "has(rules.lte) && rules.lte < rules.gte && (this.isNan() || (rules.lte < this && this < rules.gte))"
508
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
509
- }
510
- ];
511
- }
512
-
513
- // `in` requires the field value to be equal to one of the specified values.
514
- // If the field value isn't one of the specified values, an error message
515
- // is generated.
516
- //
517
- // ```proto
518
- // message MyFloat {
519
- // // value must be in list [1.0, 2.0, 3.0]
520
- // repeated float value = 1 (buf.validate.field).float = { in: [1.0, 2.0, 3.0] };
521
- // }
522
- // ```
523
- repeated float in = 6 [(priv.field).cel = {
524
- id: "float.in"
525
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
526
- }];
527
-
528
- // `in` requires the field value to not be equal to any of the specified
529
- // values. If the field value is one of the specified values, an error
530
- // message is generated.
531
- //
532
- // ```proto
533
- // message MyFloat {
534
- // // value must not be in list [1.0, 2.0, 3.0]
535
- // repeated float value = 1 (buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] };
536
- // }
537
- // ```
538
- repeated float not_in = 7 [(priv.field).cel = {
539
- id: "float.not_in"
540
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
541
- }];
542
-
543
- // `finite` requires the field value to be finite. If the field value is
544
- // infinite or NaN, an error message is generated.
545
- bool finite = 8 [(priv.field).cel = {
546
- id: "float.finite"
547
- expression: "this.isNan() || this.isInf() ? 'value must be finite' : ''"
548
- }];
549
- }
550
-
551
- // DoubleRules describes the constraints applied to `double` values. These
552
- // rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type.
553
- message DoubleRules {
554
- // `const` requires the field value to exactly match the specified value. If
555
- // the field value doesn't match, an error message is generated.
556
- //
557
- // ```proto
558
- // message MyDouble {
559
- // // value must equal 42.0
560
- // double value = 1 [(buf.validate.field).double.const = 42.0];
561
- // }
562
- // ```
563
- optional double const = 1 [(priv.field).cel = {
564
- id: "double.const"
565
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
566
- }];
567
- oneof less_than {
568
- // `lt` requires the field value to be less than the specified value (field <
569
- // value). If the field value is equal to or greater than the specified
570
- // value, an error message is generated.
571
- //
572
- // ```proto
573
- // message MyDouble {
574
- // // value must be less than 10.0
575
- // double value = 1 [(buf.validate.field).double.lt = 10.0];
576
- // }
577
- // ```
578
- double lt = 2 [(priv.field).cel = {
579
- id: "double.lt"
580
- expression:
581
- "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this >= rules.lt)"
582
- "? 'value must be less than %s'.format([rules.lt]) : ''"
583
- }];
584
-
585
- // `lte` requires the field value to be less than or equal to the specified value
586
- // (field <= value). If the field value is greater than the specified value,
587
- // an error message is generated.
588
- //
589
- // ```proto
590
- // message MyDouble {
591
- // // value must be less than or equal to 10.0
592
- // double value = 1 [(buf.validate.field).double.lte = 10.0];
593
- // }
594
- // ```
595
- double lte = 3 [(priv.field).cel = {
596
- id: "double.lte"
597
- expression:
598
- "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this > rules.lte)"
599
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
600
- }];
601
- }
602
- oneof greater_than {
603
- // `gt` requires the field value to be greater than the specified value
604
- // (exclusive). If the value of `gt` is larger than a specified `lt` or `lte`,
605
- // the range is reversed, and the field value must be outside the specified
606
- // range. If the field value doesn't meet the required conditions, an error
607
- // message is generated.
608
- //
609
- // ```proto
610
- // message MyDouble {
611
- // // value must be greater than 5.0 [double.gt]
612
- // double value = 1 [(buf.validate.field).double.gt = 5.0];
613
- //
614
- // // value must be greater than 5 and less than 10.0 [double.gt_lt]
615
- // double other_value = 2 [(buf.validate.field).double = { gt: 5.0, lt: 10.0 }];
616
- //
617
- // // value must be greater than 10 or less than 5.0 [double.gt_lt_exclusive]
618
- // double another_value = 3 [(buf.validate.field).double = { gt: 10.0, lt: 5.0 }];
619
- // }
620
- // ```
621
- double gt = 4 [
622
- (priv.field).cel = {
623
- id: "double.gt"
624
- expression:
625
- "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this <= rules.gt)"
626
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
627
- },
628
- (priv.field).cel = {
629
- id: "double.gt_lt"
630
- expression:
631
- "has(rules.lt) && rules.lt >= rules.gt && (this.isNan() || this >= rules.lt || this <= rules.gt)"
632
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
633
- },
634
- (priv.field).cel = {
635
- id: "double.gt_lt_exclusive"
636
- expression:
637
- "has(rules.lt) && rules.lt < rules.gt && (this.isNan() || (rules.lt <= this && this <= rules.gt))"
638
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
639
- },
640
- (priv.field).cel = {
641
- id: "double.gt_lte"
642
- expression:
643
- "has(rules.lte) && rules.lte >= rules.gt && (this.isNan() || this > rules.lte || this <= rules.gt)"
644
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
645
- },
646
- (priv.field).cel = {
647
- id: "double.gt_lte_exclusive"
648
- expression:
649
- "has(rules.lte) && rules.lte < rules.gt && (this.isNan() || (rules.lte < this && this <= rules.gt))"
650
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
651
- }
652
- ];
653
-
654
- // `gte` requires the field value to be greater than or equal to the specified
655
- // value (exclusive). If the value of `gte` is larger than a specified `lt` or
656
- // `lte`, the range is reversed, and the field value must be outside the
657
- // specified range. If the field value doesn't meet the required conditions,
658
- // an error message is generated.
659
- //
660
- // ```proto
661
- // message MyDouble {
662
- // // value must be greater than or equal to 5.0 [double.gte]
663
- // double value = 1 [(buf.validate.field).double.gte = 5.0];
664
- //
665
- // // value must be greater than or equal to 5.0 and less than 10.0 [double.gte_lt]
666
- // double other_value = 2 [(buf.validate.field).double = { gte: 5.0, lt: 10.0 }];
667
- //
668
- // // value must be greater than or equal to 10.0 or less than 5.0 [double.gte_lt_exclusive]
669
- // double another_value = 3 [(buf.validate.field).double = { gte: 10.0, lt: 5.0 }];
670
- // }
671
- // ```
672
- double gte = 5 [
673
- (priv.field).cel = {
674
- id: "double.gte"
675
- expression:
676
- "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this < rules.gte)"
677
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
678
- },
679
- (priv.field).cel = {
680
- id: "double.gte_lt"
681
- expression:
682
- "has(rules.lt) && rules.lt >= rules.gte && (this.isNan() || this >= rules.lt || this < rules.gte)"
683
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
684
- },
685
- (priv.field).cel = {
686
- id: "double.gte_lt_exclusive"
687
- expression:
688
- "has(rules.lt) && rules.lt < rules.gte && (this.isNan() || (rules.lt <= this && this < rules.gte))"
689
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
690
- },
691
- (priv.field).cel = {
692
- id: "double.gte_lte"
693
- expression:
694
- "has(rules.lte) && rules.lte >= rules.gte && (this.isNan() || this > rules.lte || this < rules.gte)"
695
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
696
- },
697
- (priv.field).cel = {
698
- id: "double.gte_lte_exclusive"
699
- expression:
700
- "has(rules.lte) && rules.lte < rules.gte && (this.isNan() || (rules.lte < this && this < rules.gte))"
701
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
702
- }
703
- ];
704
- }
705
- // `in` requires the field value to be equal to one of the specified values.
706
- // If the field value isn't one of the specified values, an error message is
707
- // generated.
708
- //
709
- // ```proto
710
- // message MyDouble {
711
- // // value must be in list [1.0, 2.0, 3.0]
712
- // repeated double value = 1 (buf.validate.field).double = { in: [1.0, 2.0, 3.0] };
713
- // }
714
- // ```
715
- repeated double in = 6 [(priv.field).cel = {
716
- id: "double.in"
717
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
718
- }];
719
-
720
- // `not_in` requires the field value to not be equal to any of the specified
721
- // values. If the field value is one of the specified values, an error
722
- // message is generated.
723
- //
724
- // ```proto
725
- // message MyDouble {
726
- // // value must not be in list [1.0, 2.0, 3.0]
727
- // repeated double value = 1 (buf.validate.field).double = { not_in: [1.0, 2.0, 3.0] };
728
- // }
729
- // ```
730
- repeated double not_in = 7 [(priv.field).cel = {
731
- id: "double.not_in"
732
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
733
- }];
734
-
735
- // `finite` requires the field value to be finite. If the field value is
736
- // infinite or NaN, an error message is generated.
737
- bool finite = 8 [(priv.field).cel = {
738
- id: "double.finite"
739
- expression: "this.isNan() || this.isInf() ? 'value must be finite' : ''"
740
- }];
741
- }
742
-
743
- // Int32Rules describes the constraints applied to `int32` values. These
744
- // rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type.
745
- message Int32Rules {
746
- // `const` requires the field value to exactly match the specified value. If
747
- // the field value doesn't match, an error message is generated.
748
- //
749
- // ```proto
750
- // message MyInt32 {
751
- // // value must equal 42
752
- // int32 value = 1 [(buf.validate.field).int32.const = 42];
753
- // }
754
- // ```
755
- optional int32 const = 1 [(priv.field).cel = {
756
- id: "int32.const"
757
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
758
- }];
759
- oneof less_than {
760
- // `lt` requires the field value to be less than the specified value (field
761
- // < value). If the field value is equal to or greater than the specified
762
- // value, an error message is generated.
763
- //
764
- // ```proto
765
- // message MyInt32 {
766
- // // value must be less than 10
767
- // int32 value = 1 [(buf.validate.field).int32.lt = 10];
768
- // }
769
- // ```
770
- int32 lt = 2 [(priv.field).cel = {
771
- id: "int32.lt"
772
- expression:
773
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
774
- "? 'value must be less than %s'.format([rules.lt]) : ''"
775
- }];
776
-
777
- // `lte` requires the field value to be less than or equal to the specified
778
- // value (field <= value). If the field value is greater than the specified
779
- // value, an error message is generated.
780
- //
781
- // ```proto
782
- // message MyInt32 {
783
- // // value must be less than or equal to 10
784
- // int32 value = 1 [(buf.validate.field).int32.lte = 10];
785
- // }
786
- // ```
787
- int32 lte = 3 [(priv.field).cel = {
788
- id: "int32.lte"
789
- expression:
790
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
791
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
792
- }];
793
- }
794
- oneof greater_than {
795
- // `gt` requires the field value to be greater than the specified value
796
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
797
- // `lte`, the range is reversed, and the field value must be outside the
798
- // specified range. If the field value doesn't meet the required conditions,
799
- // an error message is generated.
800
- //
801
- // ```proto
802
- // message MyInt32 {
803
- // // value must be greater than 5 [int32.gt]
804
- // int32 value = 1 [(buf.validate.field).int32.gt = 5];
805
- //
806
- // // value must be greater than 5 and less than 10 [int32.gt_lt]
807
- // int32 other_value = 2 [(buf.validate.field).int32 = { gt: 5, lt: 10 }];
808
- //
809
- // // value must be greater than 10 or less than 5 [int32.gt_lt_exclusive]
810
- // int32 another_value = 3 [(buf.validate.field).int32 = { gt: 10, lt: 5 }];
811
- // }
812
- // ```
813
- int32 gt = 4 [
814
- (priv.field).cel = {
815
- id: "int32.gt"
816
- expression:
817
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
818
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
819
- },
820
- (priv.field).cel = {
821
- id: "int32.gt_lt"
822
- expression:
823
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
824
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
825
- },
826
- (priv.field).cel = {
827
- id: "int32.gt_lt_exclusive"
828
- expression:
829
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
830
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
831
- },
832
- (priv.field).cel = {
833
- id: "int32.gt_lte"
834
- expression:
835
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
836
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
837
- },
838
- (priv.field).cel = {
839
- id: "int32.gt_lte_exclusive"
840
- expression:
841
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
842
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
843
- }
844
- ];
845
-
846
- // `gte` requires the field value to be greater than or equal to the specified value
847
- // (exclusive). If the value of `gte` is larger than a specified `lt` or
848
- // `lte`, the range is reversed, and the field value must be outside the
849
- // specified range. If the field value doesn't meet the required conditions,
850
- // an error message is generated.
851
- //
852
- // ```proto
853
- // message MyInt32 {
854
- // // value must be greater than or equal to 5 [int32.gte]
855
- // int32 value = 1 [(buf.validate.field).int32.gte = 5];
856
- //
857
- // // value must be greater than or equal to 5 and less than 10 [int32.gte_lt]
858
- // int32 other_value = 2 [(buf.validate.field).int32 = { gte: 5, lt: 10 }];
859
- //
860
- // // value must be greater than or equal to 10 or less than 5 [int32.gte_lt_exclusive]
861
- // int32 another_value = 3 [(buf.validate.field).int32 = { gte: 10, lt: 5 }];
862
- // }
863
- // ```
864
- int32 gte = 5 [
865
- (priv.field).cel = {
866
- id: "int32.gte"
867
- expression:
868
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
869
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
870
- },
871
- (priv.field).cel = {
872
- id: "int32.gte_lt"
873
- expression:
874
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
875
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
876
- },
877
- (priv.field).cel = {
878
- id: "int32.gte_lt_exclusive"
879
- expression:
880
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
881
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
882
- },
883
- (priv.field).cel = {
884
- id: "int32.gte_lte"
885
- expression:
886
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
887
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
888
- },
889
- (priv.field).cel = {
890
- id: "int32.gte_lte_exclusive"
891
- expression:
892
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
893
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
894
- }
895
- ];
896
- }
897
-
898
- // `in` requires the field value to be equal to one of the specified values.
899
- // If the field value isn't one of the specified values, an error message is
900
- // generated.
901
- //
902
- // ```proto
903
- // message MyInt32 {
904
- // // value must be in list [1, 2, 3]
905
- // repeated int32 value = 1 (buf.validate.field).int32 = { in: [1, 2, 3] };
906
- // }
907
- // ```
908
- repeated int32 in = 6 [(priv.field).cel = {
909
- id: "int32.in"
910
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
911
- }];
912
-
913
- // `not_in` requires the field value to not be equal to any of the specified
914
- // values. If the field value is one of the specified values, an error message
915
- // is generated.
916
- //
917
- // ```proto
918
- // message MyInt32 {
919
- // // value must not be in list [1, 2, 3]
920
- // repeated int32 value = 1 (buf.validate.field).int32 = { not_in: [1, 2, 3] };
921
- // }
922
- // ```
923
- repeated int32 not_in = 7 [(priv.field).cel = {
924
- id: "int32.not_in"
925
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
926
- }];
927
- }
928
-
929
- // Int64Rules describes the constraints applied to `int64` values. These
930
- // rules may also be applied to the `google.protobuf.Int64Value` Well-Known-Type.
931
- message Int64Rules {
932
- // `const` requires the field value to exactly match the specified value. If
933
- // the field value doesn't match, an error message is generated.
934
- //
935
- // ```proto
936
- // message MyInt64 {
937
- // // value must equal 42
938
- // int64 value = 1 [(buf.validate.field).int64.const = 42];
939
- // }
940
- // ```
941
- optional int64 const = 1 [(priv.field).cel = {
942
- id: "int64.const"
943
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
944
- }];
945
- oneof less_than {
946
- // `lt` requires the field value to be less than the specified value (field <
947
- // value). If the field value is equal to or greater than the specified value,
948
- // an error message is generated.
949
- //
950
- // ```proto
951
- // message MyInt64 {
952
- // // value must be less than 10
953
- // int64 value = 1 [(buf.validate.field).int64.lt = 10];
954
- // }
955
- // ```
956
- int64 lt = 2 [(priv.field).cel = {
957
- id: "int64.lt"
958
- expression:
959
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
960
- "? 'value must be less than %s'.format([rules.lt]) : ''"
961
- }];
962
-
963
- // `lte` requires the field value to be less than or equal to the specified
964
- // value (field <= value). If the field value is greater than the specified
965
- // value, an error message is generated.
966
- //
967
- // ```proto
968
- // message MyInt64 {
969
- // // value must be less than or equal to 10
970
- // int64 value = 1 [(buf.validate.field).int64.lte = 10];
971
- // }
972
- // ```
973
- int64 lte = 3 [(priv.field).cel = {
974
- id: "int64.lte"
975
- expression:
976
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
977
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
978
- }];
979
- }
980
- oneof greater_than {
981
- // `gt` requires the field value to be greater than the specified value
982
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
983
- // `lte`, the range is reversed, and the field value must be outside the
984
- // specified range. If the field value doesn't meet the required conditions,
985
- // an error message is generated.
986
- //
987
- // ```proto
988
- // message MyInt64 {
989
- // // value must be greater than 5 [int64.gt]
990
- // int64 value = 1 [(buf.validate.field).int64.gt = 5];
991
- //
992
- // // value must be greater than 5 and less than 10 [int64.gt_lt]
993
- // int64 other_value = 2 [(buf.validate.field).int64 = { gt: 5, lt: 10 }];
994
- //
995
- // // value must be greater than 10 or less than 5 [int64.gt_lt_exclusive]
996
- // int64 another_value = 3 [(buf.validate.field).int64 = { gt: 10, lt: 5 }];
997
- // }
998
- // ```
999
- int64 gt = 4 [
1000
- (priv.field).cel = {
1001
- id: "int64.gt"
1002
- expression:
1003
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
1004
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
1005
- },
1006
- (priv.field).cel = {
1007
- id: "int64.gt_lt"
1008
- expression:
1009
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
1010
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
1011
- },
1012
- (priv.field).cel = {
1013
- id: "int64.gt_lt_exclusive"
1014
- expression:
1015
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
1016
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
1017
- },
1018
- (priv.field).cel = {
1019
- id: "int64.gt_lte"
1020
- expression:
1021
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
1022
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1023
- },
1024
- (priv.field).cel = {
1025
- id: "int64.gt_lte_exclusive"
1026
- expression:
1027
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
1028
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1029
- }
1030
- ];
1031
-
1032
- // `gte` requires the field value to be greater than or equal to the specified
1033
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
1034
- // or `lte`, the range is reversed, and the field value must be outside the
1035
- // specified range. If the field value doesn't meet the required conditions,
1036
- // an error message is generated.
1037
- //
1038
- // ```proto
1039
- // message MyInt64 {
1040
- // // value must be greater than or equal to 5 [int64.gte]
1041
- // int64 value = 1 [(buf.validate.field).int64.gte = 5];
1042
- //
1043
- // // value must be greater than or equal to 5 and less than 10 [int64.gte_lt]
1044
- // int64 other_value = 2 [(buf.validate.field).int64 = { gte: 5, lt: 10 }];
1045
- //
1046
- // // value must be greater than or equal to 10 or less than 5 [int64.gte_lt_exclusive]
1047
- // int64 another_value = 3 [(buf.validate.field).int64 = { gte: 10, lt: 5 }];
1048
- // }
1049
- // ```
1050
- int64 gte = 5 [
1051
- (priv.field).cel = {
1052
- id: "int64.gte"
1053
- expression:
1054
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
1055
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
1056
- },
1057
- (priv.field).cel = {
1058
- id: "int64.gte_lt"
1059
- expression:
1060
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
1061
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
1062
- },
1063
- (priv.field).cel = {
1064
- id: "int64.gte_lt_exclusive"
1065
- expression:
1066
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
1067
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
1068
- },
1069
- (priv.field).cel = {
1070
- id: "int64.gte_lte"
1071
- expression:
1072
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
1073
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1074
- },
1075
- (priv.field).cel = {
1076
- id: "int64.gte_lte_exclusive"
1077
- expression:
1078
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
1079
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1080
- }
1081
- ];
1082
- }
1083
-
1084
- // `in` requires the field value to be equal to one of the specified values.
1085
- // If the field value isn't one of the specified values, an error message is
1086
- // generated.
1087
- //
1088
- // ```proto
1089
- // message MyInt64 {
1090
- // // value must be in list [1, 2, 3]
1091
- // repeated int64 value = 1 (buf.validate.field).int64 = { in: [1, 2, 3] };
1092
- // }
1093
- // ```
1094
- repeated int64 in = 6 [(priv.field).cel = {
1095
- id: "int64.in"
1096
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
1097
- }];
1098
-
1099
- // `not_in` requires the field value to not be equal to any of the specified
1100
- // values. If the field value is one of the specified values, an error
1101
- // message is generated.
1102
- //
1103
- // ```proto
1104
- // message MyInt64 {
1105
- // // value must not be in list [1, 2, 3]
1106
- // repeated int64 value = 1 (buf.validate.field).int64 = { not_in: [1, 2, 3] };
1107
- // }
1108
- // ```
1109
- repeated int64 not_in = 7 [(priv.field).cel = {
1110
- id: "int64.not_in"
1111
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
1112
- }];
1113
- }
1114
-
1115
- // UInt32Rules describes the constraints applied to `uint32` values. These
1116
- // rules may also be applied to the `google.protobuf.UInt32Value` Well-Known-Type.
1117
- message UInt32Rules {
1118
- // `const` requires the field value to exactly match the specified value. If
1119
- // the field value doesn't match, an error message is generated.
1120
- //
1121
- // ```proto
1122
- // message MyUInt32 {
1123
- // // value must equal 42
1124
- // uint32 value = 1 [(buf.validate.field).uint32.const = 42];
1125
- // }
1126
- // ```
1127
- optional uint32 const = 1 [(priv.field).cel = {
1128
- id: "uint32.const"
1129
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
1130
- }];
1131
- oneof less_than {
1132
- // `lt` requires the field value to be less than the specified value (field <
1133
- // value). If the field value is equal to or greater than the specified value,
1134
- // an error message is generated.
1135
- //
1136
- // ```proto
1137
- // message MyUInt32 {
1138
- // // value must be less than 10
1139
- // uint32 value = 1 [(buf.validate.field).uint32.lt = 10];
1140
- // }
1141
- // ```
1142
- uint32 lt = 2 [(priv.field).cel = {
1143
- id: "uint32.lt"
1144
- expression:
1145
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
1146
- "? 'value must be less than %s'.format([rules.lt]) : ''"
1147
- }];
1148
-
1149
- // `lte` requires the field value to be less than or equal to the specified
1150
- // value (field <= value). If the field value is greater than the specified
1151
- // value, an error message is generated.
1152
- //
1153
- // ```proto
1154
- // message MyUInt32 {
1155
- // // value must be less than or equal to 10
1156
- // uint32 value = 1 [(buf.validate.field).uint32.lte = 10];
1157
- // }
1158
- // ```
1159
- uint32 lte = 3 [(priv.field).cel = {
1160
- id: "uint32.lte"
1161
- expression:
1162
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
1163
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
1164
- }];
1165
- }
1166
- oneof greater_than {
1167
- // `gt` requires the field value to be greater than the specified value
1168
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
1169
- // `lte`, the range is reversed, and the field value must be outside the
1170
- // specified range. If the field value doesn't meet the required conditions,
1171
- // an error message is generated.
1172
- //
1173
- // ```proto
1174
- // message MyUInt32 {
1175
- // // value must be greater than 5 [uint32.gt]
1176
- // uint32 value = 1 [(buf.validate.field).uint32.gt = 5];
1177
- //
1178
- // // value must be greater than 5 and less than 10 [uint32.gt_lt]
1179
- // uint32 other_value = 2 [(buf.validate.field).uint32 = { gt: 5, lt: 10 }];
1180
- //
1181
- // // value must be greater than 10 or less than 5 [uint32.gt_lt_exclusive]
1182
- // uint32 another_value = 3 [(buf.validate.field).uint32 = { gt: 10, lt: 5 }];
1183
- // }
1184
- // ```
1185
- uint32 gt = 4 [
1186
- (priv.field).cel = {
1187
- id: "uint32.gt"
1188
- expression:
1189
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
1190
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
1191
- },
1192
- (priv.field).cel = {
1193
- id: "uint32.gt_lt"
1194
- expression:
1195
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
1196
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
1197
- },
1198
- (priv.field).cel = {
1199
- id: "uint32.gt_lt_exclusive"
1200
- expression:
1201
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
1202
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
1203
- },
1204
- (priv.field).cel = {
1205
- id: "uint32.gt_lte"
1206
- expression:
1207
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
1208
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1209
- },
1210
- (priv.field).cel = {
1211
- id: "uint32.gt_lte_exclusive"
1212
- expression:
1213
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
1214
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1215
- }
1216
- ];
1217
-
1218
- // `gte` requires the field value to be greater than or equal to the specified
1219
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
1220
- // or `lte`, the range is reversed, and the field value must be outside the
1221
- // specified range. If the field value doesn't meet the required conditions,
1222
- // an error message is generated.
1223
- //
1224
- // ```proto
1225
- // message MyUInt32 {
1226
- // // value must be greater than or equal to 5 [uint32.gte]
1227
- // uint32 value = 1 [(buf.validate.field).uint32.gte = 5];
1228
- //
1229
- // // value must be greater than or equal to 5 and less than 10 [uint32.gte_lt]
1230
- // uint32 other_value = 2 [(buf.validate.field).uint32 = { gte: 5, lt: 10 }];
1231
- //
1232
- // // value must be greater than or equal to 10 or less than 5 [uint32.gte_lt_exclusive]
1233
- // uint32 another_value = 3 [(buf.validate.field).uint32 = { gte: 10, lt: 5 }];
1234
- // }
1235
- // ```
1236
- uint32 gte = 5 [
1237
- (priv.field).cel = {
1238
- id: "uint32.gte"
1239
- expression:
1240
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
1241
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
1242
- },
1243
- (priv.field).cel = {
1244
- id: "uint32.gte_lt"
1245
- expression:
1246
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
1247
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
1248
- },
1249
- (priv.field).cel = {
1250
- id: "uint32.gte_lt_exclusive"
1251
- expression:
1252
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
1253
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
1254
- },
1255
- (priv.field).cel = {
1256
- id: "uint32.gte_lte"
1257
- expression:
1258
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
1259
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1260
- },
1261
- (priv.field).cel = {
1262
- id: "uint32.gte_lte_exclusive"
1263
- expression:
1264
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
1265
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1266
- }
1267
- ];
1268
- }
1269
-
1270
- // `in` requires the field value to be equal to one of the specified values.
1271
- // If the field value isn't one of the specified values, an error message is
1272
- // generated.
1273
- //
1274
- // ```proto
1275
- // message MyUInt32 {
1276
- // // value must be in list [1, 2, 3]
1277
- // repeated uint32 value = 1 (buf.validate.field).uint32 = { in: [1, 2, 3] };
1278
- // }
1279
- // ```
1280
- repeated uint32 in = 6 [(priv.field).cel = {
1281
- id: "uint32.in"
1282
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
1283
- }];
1284
-
1285
- // `not_in` requires the field value to not be equal to any of the specified
1286
- // values. If the field value is one of the specified values, an error
1287
- // message is generated.
1288
- //
1289
- // ```proto
1290
- // message MyUInt32 {
1291
- // // value must not be in list [1, 2, 3]
1292
- // repeated uint32 value = 1 (buf.validate.field).uint32 = { not_in: [1, 2, 3] };
1293
- // }
1294
- // ```
1295
- repeated uint32 not_in = 7 [(priv.field).cel = {
1296
- id: "uint32.not_in"
1297
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
1298
- }];
1299
- }
1300
-
1301
- // UInt64Rules describes the constraints applied to `uint64` values. These
1302
- // rules may also be applied to the `google.protobuf.UInt64Value` Well-Known-Type.
1303
- message UInt64Rules {
1304
- // `const` requires the field value to exactly match the specified value. If
1305
- // the field value doesn't match, an error message is generated.
1306
- //
1307
- // ```proto
1308
- // message MyUInt64 {
1309
- // // value must equal 42
1310
- // uint64 value = 1 [(buf.validate.field).uint64.const = 42];
1311
- // }
1312
- // ```
1313
- optional uint64 const = 1 [(priv.field).cel = {
1314
- id: "uint64.const"
1315
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
1316
- }];
1317
- oneof less_than {
1318
- // `lt` requires the field value to be less than the specified value (field <
1319
- // value). If the field value is equal to or greater than the specified value,
1320
- // an error message is generated.
1321
- //
1322
- // ```proto
1323
- // message MyUInt64 {
1324
- // // value must be less than 10
1325
- // uint64 value = 1 [(buf.validate.field).uint64.lt = 10];
1326
- // }
1327
- // ```
1328
- uint64 lt = 2 [(priv.field).cel = {
1329
- id: "uint64.lt"
1330
- expression:
1331
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
1332
- "? 'value must be less than %s'.format([rules.lt]) : ''"
1333
- }];
1334
-
1335
- // `lte` requires the field value to be less than or equal to the specified
1336
- // value (field <= value). If the field value is greater than the specified
1337
- // value, an error message is generated.
1338
- //
1339
- // ```proto
1340
- // message MyUInt64 {
1341
- // // value must be less than or equal to 10
1342
- // uint64 value = 1 [(buf.validate.field).uint64.lte = 10];
1343
- // }
1344
- // ```
1345
- uint64 lte = 3 [(priv.field).cel = {
1346
- id: "uint64.lte"
1347
- expression:
1348
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
1349
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
1350
- }];
1351
- }
1352
- oneof greater_than {
1353
- // `gt` requires the field value to be greater than the specified value
1354
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
1355
- // `lte`, the range is reversed, and the field value must be outside the
1356
- // specified range. If the field value doesn't meet the required conditions,
1357
- // an error message is generated.
1358
- //
1359
- // ```proto
1360
- // message MyUInt64 {
1361
- // // value must be greater than 5 [uint64.gt]
1362
- // uint64 value = 1 [(buf.validate.field).uint64.gt = 5];
1363
- //
1364
- // // value must be greater than 5 and less than 10 [uint64.gt_lt]
1365
- // uint64 other_value = 2 [(buf.validate.field).uint64 = { gt: 5, lt: 10 }];
1366
- //
1367
- // // value must be greater than 10 or less than 5 [uint64.gt_lt_exclusive]
1368
- // uint64 another_value = 3 [(buf.validate.field).uint64 = { gt: 10, lt: 5 }];
1369
- // }
1370
- // ```
1371
- uint64 gt = 4 [
1372
- (priv.field).cel = {
1373
- id: "uint64.gt"
1374
- expression:
1375
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
1376
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
1377
- },
1378
- (priv.field).cel = {
1379
- id: "uint64.gt_lt"
1380
- expression:
1381
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
1382
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
1383
- },
1384
- (priv.field).cel = {
1385
- id: "uint64.gt_lt_exclusive"
1386
- expression:
1387
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
1388
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
1389
- },
1390
- (priv.field).cel = {
1391
- id: "uint64.gt_lte"
1392
- expression:
1393
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
1394
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1395
- },
1396
- (priv.field).cel = {
1397
- id: "uint64.gt_lte_exclusive"
1398
- expression:
1399
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
1400
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1401
- }
1402
- ];
1403
-
1404
- // `gte` requires the field value to be greater than or equal to the specified
1405
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
1406
- // or `lte`, the range is reversed, and the field value must be outside the
1407
- // specified range. If the field value doesn't meet the required conditions,
1408
- // an error message is generated.
1409
- //
1410
- // ```proto
1411
- // message MyUInt64 {
1412
- // // value must be greater than or equal to 5 [uint64.gte]
1413
- // uint64 value = 1 [(buf.validate.field).uint64.gte = 5];
1414
- //
1415
- // // value must be greater than or equal to 5 and less than 10 [uint64.gte_lt]
1416
- // uint64 other_value = 2 [(buf.validate.field).uint64 = { gte: 5, lt: 10 }];
1417
- //
1418
- // // value must be greater than or equal to 10 or less than 5 [uint64.gte_lt_exclusive]
1419
- // uint64 another_value = 3 [(buf.validate.field).uint64 = { gte: 10, lt: 5 }];
1420
- // }
1421
- // ```
1422
- uint64 gte = 5 [
1423
- (priv.field).cel = {
1424
- id: "uint64.gte"
1425
- expression:
1426
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
1427
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
1428
- },
1429
- (priv.field).cel = {
1430
- id: "uint64.gte_lt"
1431
- expression:
1432
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
1433
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
1434
- },
1435
- (priv.field).cel = {
1436
- id: "uint64.gte_lt_exclusive"
1437
- expression:
1438
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
1439
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
1440
- },
1441
- (priv.field).cel = {
1442
- id: "uint64.gte_lte"
1443
- expression:
1444
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
1445
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1446
- },
1447
- (priv.field).cel = {
1448
- id: "uint64.gte_lte_exclusive"
1449
- expression:
1450
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
1451
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1452
- }
1453
- ];
1454
- }
1455
- // `in` requires the field value to be equal to one of the specified values.
1456
- // If the field value isn't one of the specified values, an error message is
1457
- // generated.
1458
- //
1459
- // ```proto
1460
- // message MyUInt64 {
1461
- // // value must be in list [1, 2, 3]
1462
- // repeated uint64 value = 1 (buf.validate.field).uint64 = { in: [1, 2, 3] };
1463
- // }
1464
- // ```
1465
- repeated uint64 in = 6 [(priv.field).cel = {
1466
- id: "uint64.in"
1467
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
1468
- }];
1469
-
1470
- // `not_in` requires the field value to not be equal to any of the specified
1471
- // values. If the field value is one of the specified values, an error
1472
- // message is generated.
1473
- //
1474
- // ```proto
1475
- // message MyUInt64 {
1476
- // // value must not be in list [1, 2, 3]
1477
- // repeated uint64 value = 1 (buf.validate.field).uint64 = { not_in: [1, 2, 3] };
1478
- // }
1479
- // ```
1480
- repeated uint64 not_in = 7 [(priv.field).cel = {
1481
- id: "uint64.not_in"
1482
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
1483
- }];
1484
- }
1485
-
1486
- // SInt32Rules describes the constraints applied to `sint32` values.
1487
- message SInt32Rules {
1488
- // `const` requires the field value to exactly match the specified value. If
1489
- // the field value doesn't match, an error message is generated.
1490
- //
1491
- // ```proto
1492
- // message MySInt32 {
1493
- // // value must equal 42
1494
- // sint32 value = 1 [(buf.validate.field).sint32.const = 42];
1495
- // }
1496
- // ```
1497
- optional sint32 const = 1 [(priv.field).cel = {
1498
- id: "sint32.const"
1499
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
1500
- }];
1501
- oneof less_than {
1502
- // `lt` requires the field value to be less than the specified value (field
1503
- // < value). If the field value is equal to or greater than the specified
1504
- // value, an error message is generated.
1505
- //
1506
- // ```proto
1507
- // message MySInt32 {
1508
- // // value must be less than 10
1509
- // sint32 value = 1 [(buf.validate.field).sint32.lt = 10];
1510
- // }
1511
- // ```
1512
- sint32 lt = 2 [(priv.field).cel = {
1513
- id: "sint32.lt"
1514
- expression:
1515
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
1516
- "? 'value must be less than %s'.format([rules.lt]) : ''"
1517
- }];
1518
-
1519
- // `lte` requires the field value to be less than or equal to the specified
1520
- // value (field <= value). If the field value is greater than the specified
1521
- // value, an error message is generated.
1522
- //
1523
- // ```proto
1524
- // message MySInt32 {
1525
- // // value must be less than or equal to 10
1526
- // sint32 value = 1 [(buf.validate.field).sint32.lte = 10];
1527
- // }
1528
- // ```
1529
- sint32 lte = 3 [(priv.field).cel = {
1530
- id: "sint32.lte"
1531
- expression:
1532
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
1533
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
1534
- }];
1535
- }
1536
- oneof greater_than {
1537
- // `gt` requires the field value to be greater than the specified value
1538
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
1539
- // `lte`, the range is reversed, and the field value must be outside the
1540
- // specified range. If the field value doesn't meet the required conditions,
1541
- // an error message is generated.
1542
- //
1543
- // ```proto
1544
- // message MySInt32 {
1545
- // // value must be greater than 5 [sint32.gt]
1546
- // sint32 value = 1 [(buf.validate.field).sint32.gt = 5];
1547
- //
1548
- // // value must be greater than 5 and less than 10 [sint32.gt_lt]
1549
- // sint32 other_value = 2 [(buf.validate.field).sint32 = { gt: 5, lt: 10 }];
1550
- //
1551
- // // value must be greater than 10 or less than 5 [sint32.gt_lt_exclusive]
1552
- // sint32 another_value = 3 [(buf.validate.field).sint32 = { gt: 10, lt: 5 }];
1553
- // }
1554
- // ```
1555
- sint32 gt = 4 [
1556
- (priv.field).cel = {
1557
- id: "sint32.gt"
1558
- expression:
1559
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
1560
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
1561
- },
1562
- (priv.field).cel = {
1563
- id: "sint32.gt_lt"
1564
- expression:
1565
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
1566
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
1567
- },
1568
- (priv.field).cel = {
1569
- id: "sint32.gt_lt_exclusive"
1570
- expression:
1571
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
1572
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
1573
- },
1574
- (priv.field).cel = {
1575
- id: "sint32.gt_lte"
1576
- expression:
1577
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
1578
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1579
- },
1580
- (priv.field).cel = {
1581
- id: "sint32.gt_lte_exclusive"
1582
- expression:
1583
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
1584
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1585
- }
1586
- ];
1587
-
1588
- // `gte` requires the field value to be greater than or equal to the specified
1589
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
1590
- // or `lte`, the range is reversed, and the field value must be outside the
1591
- // specified range. If the field value doesn't meet the required conditions,
1592
- // an error message is generated.
1593
- //
1594
- // ```proto
1595
- // message MySInt32 {
1596
- // // value must be greater than or equal to 5 [sint32.gte]
1597
- // sint32 value = 1 [(buf.validate.field).sint32.gte = 5];
1598
- //
1599
- // // value must be greater than or equal to 5 and less than 10 [sint32.gte_lt]
1600
- // sint32 other_value = 2 [(buf.validate.field).sint32 = { gte: 5, lt: 10 }];
1601
- //
1602
- // // value must be greater than or equal to 10 or less than 5 [sint32.gte_lt_exclusive]
1603
- // sint32 another_value = 3 [(buf.validate.field).sint32 = { gte: 10, lt: 5 }];
1604
- // }
1605
- // ```
1606
- sint32 gte = 5 [
1607
- (priv.field).cel = {
1608
- id: "sint32.gte"
1609
- expression:
1610
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
1611
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
1612
- },
1613
- (priv.field).cel = {
1614
- id: "sint32.gte_lt"
1615
- expression:
1616
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
1617
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
1618
- },
1619
- (priv.field).cel = {
1620
- id: "sint32.gte_lt_exclusive"
1621
- expression:
1622
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
1623
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
1624
- },
1625
- (priv.field).cel = {
1626
- id: "sint32.gte_lte"
1627
- expression:
1628
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
1629
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1630
- },
1631
- (priv.field).cel = {
1632
- id: "sint32.gte_lte_exclusive"
1633
- expression:
1634
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
1635
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1636
- }
1637
- ];
1638
- }
1639
-
1640
- // `in` requires the field value to be equal to one of the specified values.
1641
- // If the field value isn't one of the specified values, an error message is
1642
- // generated.
1643
- //
1644
- // ```proto
1645
- // message MySInt32 {
1646
- // // value must be in list [1, 2, 3]
1647
- // repeated sint32 value = 1 (buf.validate.field).sint32 = { in: [1, 2, 3] };
1648
- // }
1649
- // ```
1650
- repeated sint32 in = 6 [(priv.field).cel = {
1651
- id: "sint32.in"
1652
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
1653
- }];
1654
-
1655
- // `not_in` requires the field value to not be equal to any of the specified
1656
- // values. If the field value is one of the specified values, an error
1657
- // message is generated.
1658
- //
1659
- // ```proto
1660
- // message MySInt32 {
1661
- // // value must not be in list [1, 2, 3]
1662
- // repeated sint32 value = 1 (buf.validate.field).sint32 = { not_in: [1, 2, 3] };
1663
- // }
1664
- // ```
1665
- repeated sint32 not_in = 7 [(priv.field).cel = {
1666
- id: "sint32.not_in"
1667
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
1668
- }];
1669
- }
1670
-
1671
- // SInt64Rules describes the constraints applied to `sint64` values.
1672
- message SInt64Rules {
1673
- // `const` requires the field value to exactly match the specified value. If
1674
- // the field value doesn't match, an error message is generated.
1675
- //
1676
- // ```proto
1677
- // message MySInt64 {
1678
- // // value must equal 42
1679
- // sint64 value = 1 [(buf.validate.field).sint64.const = 42];
1680
- // }
1681
- // ```
1682
- optional sint64 const = 1 [(priv.field).cel = {
1683
- id: "sint64.const"
1684
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
1685
- }];
1686
- oneof less_than {
1687
- // `lt` requires the field value to be less than the specified value (field
1688
- // < value). If the field value is equal to or greater than the specified
1689
- // value, an error message is generated.
1690
- //
1691
- // ```proto
1692
- // message MySInt64 {
1693
- // // value must be less than 10
1694
- // sint64 value = 1 [(buf.validate.field).sint64.lt = 10];
1695
- // }
1696
- // ```
1697
- sint64 lt = 2 [(priv.field).cel = {
1698
- id: "sint64.lt"
1699
- expression:
1700
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
1701
- "? 'value must be less than %s'.format([rules.lt]) : ''"
1702
- }];
1703
-
1704
- // `lte` requires the field value to be less than or equal to the specified
1705
- // value (field <= value). If the field value is greater than the specified
1706
- // value, an error message is generated.
1707
- //
1708
- // ```proto
1709
- // message MySInt64 {
1710
- // // value must be less than or equal to 10
1711
- // sint64 value = 1 [(buf.validate.field).sint64.lte = 10];
1712
- // }
1713
- // ```
1714
- sint64 lte = 3 [(priv.field).cel = {
1715
- id: "sint64.lte"
1716
- expression:
1717
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
1718
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
1719
- }];
1720
- }
1721
- oneof greater_than {
1722
- // `gt` requires the field value to be greater than the specified value
1723
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
1724
- // `lte`, the range is reversed, and the field value must be outside the
1725
- // specified range. If the field value doesn't meet the required conditions,
1726
- // an error message is generated.
1727
- //
1728
- // ```proto
1729
- // message MySInt64 {
1730
- // // value must be greater than 5 [sint64.gt]
1731
- // sint64 value = 1 [(buf.validate.field).sint64.gt = 5];
1732
- //
1733
- // // value must be greater than 5 and less than 10 [sint64.gt_lt]
1734
- // sint64 other_value = 2 [(buf.validate.field).sint64 = { gt: 5, lt: 10 }];
1735
- //
1736
- // // value must be greater than 10 or less than 5 [sint64.gt_lt_exclusive]
1737
- // sint64 another_value = 3 [(buf.validate.field).sint64 = { gt: 10, lt: 5 }];
1738
- // }
1739
- // ```
1740
- sint64 gt = 4 [
1741
- (priv.field).cel = {
1742
- id: "sint64.gt"
1743
- expression:
1744
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
1745
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
1746
- },
1747
- (priv.field).cel = {
1748
- id: "sint64.gt_lt"
1749
- expression:
1750
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
1751
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
1752
- },
1753
- (priv.field).cel = {
1754
- id: "sint64.gt_lt_exclusive"
1755
- expression:
1756
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
1757
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
1758
- },
1759
- (priv.field).cel = {
1760
- id: "sint64.gt_lte"
1761
- expression:
1762
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
1763
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1764
- },
1765
- (priv.field).cel = {
1766
- id: "sint64.gt_lte_exclusive"
1767
- expression:
1768
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
1769
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1770
- }
1771
- ];
1772
-
1773
- // `gte` requires the field value to be greater than or equal to the specified
1774
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
1775
- // or `lte`, the range is reversed, and the field value must be outside the
1776
- // specified range. If the field value doesn't meet the required conditions,
1777
- // an error message is generated.
1778
- //
1779
- // ```proto
1780
- // message MySInt64 {
1781
- // // value must be greater than or equal to 5 [sint64.gte]
1782
- // sint64 value = 1 [(buf.validate.field).sint64.gte = 5];
1783
- //
1784
- // // value must be greater than or equal to 5 and less than 10 [sint64.gte_lt]
1785
- // sint64 other_value = 2 [(buf.validate.field).sint64 = { gte: 5, lt: 10 }];
1786
- //
1787
- // // value must be greater than or equal to 10 or less than 5 [sint64.gte_lt_exclusive]
1788
- // sint64 another_value = 3 [(buf.validate.field).sint64 = { gte: 10, lt: 5 }];
1789
- // }
1790
- // ```
1791
- sint64 gte = 5 [
1792
- (priv.field).cel = {
1793
- id: "sint64.gte"
1794
- expression:
1795
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
1796
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
1797
- },
1798
- (priv.field).cel = {
1799
- id: "sint64.gte_lt"
1800
- expression:
1801
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
1802
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
1803
- },
1804
- (priv.field).cel = {
1805
- id: "sint64.gte_lt_exclusive"
1806
- expression:
1807
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
1808
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
1809
- },
1810
- (priv.field).cel = {
1811
- id: "sint64.gte_lte"
1812
- expression:
1813
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
1814
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1815
- },
1816
- (priv.field).cel = {
1817
- id: "sint64.gte_lte_exclusive"
1818
- expression:
1819
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
1820
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
1821
- }
1822
- ];
1823
- }
1824
-
1825
- // `in` requires the field value to be equal to one of the specified values.
1826
- // If the field value isn't one of the specified values, an error message
1827
- // is generated.
1828
- //
1829
- // ```proto
1830
- // message MySInt64 {
1831
- // // value must be in list [1, 2, 3]
1832
- // repeated sint64 value = 1 (buf.validate.field).sint64 = { in: [1, 2, 3] };
1833
- // }
1834
- // ```
1835
- repeated sint64 in = 6 [(priv.field).cel = {
1836
- id: "sint64.in"
1837
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
1838
- }];
1839
-
1840
- // `not_in` requires the field value to not be equal to any of the specified
1841
- // values. If the field value is one of the specified values, an error
1842
- // message is generated.
1843
- //
1844
- // ```proto
1845
- // message MySInt64 {
1846
- // // value must not be in list [1, 2, 3]
1847
- // repeated sint64 value = 1 (buf.validate.field).sint64 = { not_in: [1, 2, 3] };
1848
- // }
1849
- // ```
1850
- repeated sint64 not_in = 7 [(priv.field).cel = {
1851
- id: "sint64.not_in"
1852
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
1853
- }];
1854
- }
1855
-
1856
- // Fixed32Rules describes the constraints applied to `fixed32` values.
1857
- message Fixed32Rules {
1858
- // `const` requires the field value to exactly match the specified value.
1859
- // If the field value doesn't match, an error message is generated.
1860
- //
1861
- // ```proto
1862
- // message MyFixed32 {
1863
- // // value must equal 42
1864
- // fixed32 value = 1 [(buf.validate.field).fixed32.const = 42];
1865
- // }
1866
- // ```
1867
- optional fixed32 const = 1 [(priv.field).cel = {
1868
- id: "fixed32.const"
1869
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
1870
- }];
1871
- oneof less_than {
1872
- // `lt` requires the field value to be less than the specified value (field <
1873
- // value). If the field value is equal to or greater than the specified value,
1874
- // an error message is generated.
1875
- //
1876
- // ```proto
1877
- // message MyFixed32 {
1878
- // // value must be less than 10
1879
- // fixed32 value = 1 [(buf.validate.field).fixed32.lt = 10];
1880
- // }
1881
- // ```
1882
- fixed32 lt = 2 [(priv.field).cel = {
1883
- id: "fixed32.lt"
1884
- expression:
1885
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
1886
- "? 'value must be less than %s'.format([rules.lt]) : ''"
1887
- }];
1888
-
1889
- // `lte` requires the field value to be less than or equal to the specified
1890
- // value (field <= value). If the field value is greater than the specified
1891
- // value, an error message is generated.
1892
- //
1893
- // ```proto
1894
- // message MyFixed32 {
1895
- // // value must be less than or equal to 10
1896
- // fixed32 value = 1 [(buf.validate.field).fixed32.lte = 10];
1897
- // }
1898
- // ```
1899
- fixed32 lte = 3 [(priv.field).cel = {
1900
- id: "fixed32.lte"
1901
- expression:
1902
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
1903
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
1904
- }];
1905
- }
1906
- oneof greater_than {
1907
- // `gt` requires the field value to be greater than the specified value
1908
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
1909
- // `lte`, the range is reversed, and the field value must be outside the
1910
- // specified range. If the field value doesn't meet the required conditions,
1911
- // an error message is generated.
1912
- //
1913
- // ```proto
1914
- // message MyFixed32 {
1915
- // // value must be greater than 5 [fixed32.gt]
1916
- // fixed32 value = 1 [(buf.validate.field).fixed32.gt = 5];
1917
- //
1918
- // // value must be greater than 5 and less than 10 [fixed32.gt_lt]
1919
- // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gt: 5, lt: 10 }];
1920
- //
1921
- // // value must be greater than 10 or less than 5 [fixed32.gt_lt_exclusive]
1922
- // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gt: 10, lt: 5 }];
1923
- // }
1924
- // ```
1925
- fixed32 gt = 4 [
1926
- (priv.field).cel = {
1927
- id: "fixed32.gt"
1928
- expression:
1929
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
1930
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
1931
- },
1932
- (priv.field).cel = {
1933
- id: "fixed32.gt_lt"
1934
- expression:
1935
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
1936
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
1937
- },
1938
- (priv.field).cel = {
1939
- id: "fixed32.gt_lt_exclusive"
1940
- expression:
1941
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
1942
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
1943
- },
1944
- (priv.field).cel = {
1945
- id: "fixed32.gt_lte"
1946
- expression:
1947
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
1948
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1949
- },
1950
- (priv.field).cel = {
1951
- id: "fixed32.gt_lte_exclusive"
1952
- expression:
1953
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
1954
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
1955
- }
1956
- ];
1957
-
1958
- // `gte` requires the field value to be greater than or equal to the specified
1959
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
1960
- // or `lte`, the range is reversed, and the field value must be outside the
1961
- // specified range. If the field value doesn't meet the required conditions,
1962
- // an error message is generated.
1963
- //
1964
- // ```proto
1965
- // message MyFixed32 {
1966
- // // value must be greater than or equal to 5 [fixed32.gte]
1967
- // fixed32 value = 1 [(buf.validate.field).fixed32.gte = 5];
1968
- //
1969
- // // value must be greater than or equal to 5 and less than 10 [fixed32.gte_lt]
1970
- // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gte: 5, lt: 10 }];
1971
- //
1972
- // // value must be greater than or equal to 10 or less than 5 [fixed32.gte_lt_exclusive]
1973
- // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gte: 10, lt: 5 }];
1974
- // }
1975
- // ```
1976
- fixed32 gte = 5 [
1977
- (priv.field).cel = {
1978
- id: "fixed32.gte"
1979
- expression:
1980
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
1981
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
1982
- },
1983
- (priv.field).cel = {
1984
- id: "fixed32.gte_lt"
1985
- expression:
1986
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
1987
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
1988
- },
1989
- (priv.field).cel = {
1990
- id: "fixed32.gte_lt_exclusive"
1991
- expression:
1992
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
1993
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
1994
- },
1995
- (priv.field).cel = {
1996
- id: "fixed32.gte_lte"
1997
- expression:
1998
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
1999
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
2000
- },
2001
- (priv.field).cel = {
2002
- id: "fixed32.gte_lte_exclusive"
2003
- expression:
2004
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
2005
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
2006
- }
2007
- ];
2008
- }
2009
-
2010
- // `in` requires the field value to be equal to one of the specified values.
2011
- // If the field value isn't one of the specified values, an error message
2012
- // is generated.
2013
- //
2014
- // ```proto
2015
- // message MyFixed32 {
2016
- // // value must be in list [1, 2, 3]
2017
- // repeated fixed32 value = 1 (buf.validate.field).fixed32 = { in: [1, 2, 3] };
2018
- // }
2019
- // ```
2020
- repeated fixed32 in = 6 [(priv.field).cel = {
2021
- id: "fixed32.in"
2022
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
2023
- }];
2024
-
2025
- // `not_in` requires the field value to not be equal to any of the specified
2026
- // values. If the field value is one of the specified values, an error
2027
- // message is generated.
2028
- //
2029
- // ```proto
2030
- // message MyFixed32 {
2031
- // // value must not be in list [1, 2, 3]
2032
- // repeated fixed32 value = 1 (buf.validate.field).fixed32 = { not_in: [1, 2, 3] };
2033
- // }
2034
- // ```
2035
- repeated fixed32 not_in = 7 [(priv.field).cel = {
2036
- id: "fixed32.not_in"
2037
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
2038
- }];
2039
- }
2040
-
2041
- // Fixed64Rules describes the constraints applied to `fixed64` values.
2042
- message Fixed64Rules {
2043
- // `const` requires the field value to exactly match the specified value. If
2044
- // the field value doesn't match, an error message is generated.
2045
- //
2046
- // ```proto
2047
- // message MyFixed64 {
2048
- // // value must equal 42
2049
- // fixed64 value = 1 [(buf.validate.field).fixed64.const = 42];
2050
- // }
2051
- // ```
2052
- optional fixed64 const = 1 [(priv.field).cel = {
2053
- id: "fixed64.const"
2054
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
2055
- }];
2056
- oneof less_than {
2057
- // `lt` requires the field value to be less than the specified value (field <
2058
- // value). If the field value is equal to or greater than the specified value,
2059
- // an error message is generated.
2060
- //
2061
- // ```proto
2062
- // message MyFixed64 {
2063
- // // value must be less than 10
2064
- // fixed64 value = 1 [(buf.validate.field).fixed64.lt = 10];
2065
- // }
2066
- // ```
2067
- fixed64 lt = 2 [(priv.field).cel = {
2068
- id: "fixed64.lt"
2069
- expression:
2070
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
2071
- "? 'value must be less than %s'.format([rules.lt]) : ''"
2072
- }];
2073
-
2074
- // `lte` requires the field value to be less than or equal to the specified
2075
- // value (field <= value). If the field value is greater than the specified
2076
- // value, an error message is generated.
2077
- //
2078
- // ```proto
2079
- // message MyFixed64 {
2080
- // // value must be less than or equal to 10
2081
- // fixed64 value = 1 [(buf.validate.field).fixed64.lte = 10];
2082
- // }
2083
- // ```
2084
- fixed64 lte = 3 [(priv.field).cel = {
2085
- id: "fixed64.lte"
2086
- expression:
2087
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
2088
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
2089
- }];
2090
- }
2091
- oneof greater_than {
2092
- // `gt` requires the field value to be greater than the specified value
2093
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
2094
- // `lte`, the range is reversed, and the field value must be outside the
2095
- // specified range. If the field value doesn't meet the required conditions,
2096
- // an error message is generated.
2097
- //
2098
- // ```proto
2099
- // message MyFixed64 {
2100
- // // value must be greater than 5 [fixed64.gt]
2101
- // fixed64 value = 1 [(buf.validate.field).fixed64.gt = 5];
2102
- //
2103
- // // value must be greater than 5 and less than 10 [fixed64.gt_lt]
2104
- // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gt: 5, lt: 10 }];
2105
- //
2106
- // // value must be greater than 10 or less than 5 [fixed64.gt_lt_exclusive]
2107
- // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gt: 10, lt: 5 }];
2108
- // }
2109
- // ```
2110
- fixed64 gt = 4 [
2111
- (priv.field).cel = {
2112
- id: "fixed64.gt"
2113
- expression:
2114
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
2115
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
2116
- },
2117
- (priv.field).cel = {
2118
- id: "fixed64.gt_lt"
2119
- expression:
2120
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
2121
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
2122
- },
2123
- (priv.field).cel = {
2124
- id: "fixed64.gt_lt_exclusive"
2125
- expression:
2126
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
2127
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
2128
- },
2129
- (priv.field).cel = {
2130
- id: "fixed64.gt_lte"
2131
- expression:
2132
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
2133
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
2134
- },
2135
- (priv.field).cel = {
2136
- id: "fixed64.gt_lte_exclusive"
2137
- expression:
2138
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
2139
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
2140
- }
2141
- ];
2142
-
2143
- // `gte` requires the field value to be greater than or equal to the specified
2144
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
2145
- // or `lte`, the range is reversed, and the field value must be outside the
2146
- // specified range. If the field value doesn't meet the required conditions,
2147
- // an error message is generated.
2148
- //
2149
- // ```proto
2150
- // message MyFixed64 {
2151
- // // value must be greater than or equal to 5 [fixed64.gte]
2152
- // fixed64 value = 1 [(buf.validate.field).fixed64.gte = 5];
2153
- //
2154
- // // value must be greater than or equal to 5 and less than 10 [fixed64.gte_lt]
2155
- // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gte: 5, lt: 10 }];
2156
- //
2157
- // // value must be greater than or equal to 10 or less than 5 [fixed64.gte_lt_exclusive]
2158
- // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gte: 10, lt: 5 }];
2159
- // }
2160
- // ```
2161
- fixed64 gte = 5 [
2162
- (priv.field).cel = {
2163
- id: "fixed64.gte"
2164
- expression:
2165
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
2166
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
2167
- },
2168
- (priv.field).cel = {
2169
- id: "fixed64.gte_lt"
2170
- expression:
2171
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
2172
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
2173
- },
2174
- (priv.field).cel = {
2175
- id: "fixed64.gte_lt_exclusive"
2176
- expression:
2177
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
2178
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
2179
- },
2180
- (priv.field).cel = {
2181
- id: "fixed64.gte_lte"
2182
- expression:
2183
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
2184
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
2185
- },
2186
- (priv.field).cel = {
2187
- id: "fixed64.gte_lte_exclusive"
2188
- expression:
2189
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
2190
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
2191
- }
2192
- ];
2193
- }
2194
-
2195
- // `in` requires the field value to be equal to one of the specified values.
2196
- // If the field value isn't one of the specified values, an error message is
2197
- // generated.
2198
- //
2199
- // ```proto
2200
- // message MyFixed64 {
2201
- // // value must be in list [1, 2, 3]
2202
- // repeated fixed64 value = 1 (buf.validate.field).fixed64 = { in: [1, 2, 3] };
2203
- // }
2204
- // ```
2205
- repeated fixed64 in = 6 [(priv.field).cel = {
2206
- id: "fixed64.in"
2207
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
2208
- }];
2209
-
2210
- // `not_in` requires the field value to not be equal to any of the specified
2211
- // values. If the field value is one of the specified values, an error
2212
- // message is generated.
2213
- //
2214
- // ```proto
2215
- // message MyFixed64 {
2216
- // // value must not be in list [1, 2, 3]
2217
- // repeated fixed64 value = 1 (buf.validate.field).fixed64 = { not_in: [1, 2, 3] };
2218
- // }
2219
- // ```
2220
- repeated fixed64 not_in = 7 [(priv.field).cel = {
2221
- id: "fixed64.not_in"
2222
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
2223
- }];
2224
- }
2225
-
2226
- // SFixed32Rules describes the constraints applied to `fixed32` values.
2227
- message SFixed32Rules {
2228
- // `const` requires the field value to exactly match the specified value. If
2229
- // the field value doesn't match, an error message is generated.
2230
- //
2231
- // ```proto
2232
- // message MySFixed32 {
2233
- // // value must equal 42
2234
- // sfixed32 value = 1 [(buf.validate.field).sfixed32.const = 42];
2235
- // }
2236
- // ```
2237
- optional sfixed32 const = 1 [(priv.field).cel = {
2238
- id: "sfixed32.const"
2239
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
2240
- }];
2241
- oneof less_than {
2242
- // `lt` requires the field value to be less than the specified value (field <
2243
- // value). If the field value is equal to or greater than the specified value,
2244
- // an error message is generated.
2245
- //
2246
- // ```proto
2247
- // message MySFixed32 {
2248
- // // value must be less than 10
2249
- // sfixed32 value = 1 [(buf.validate.field).sfixed32.lt = 10];
2250
- // }
2251
- // ```
2252
- sfixed32 lt = 2 [(priv.field).cel = {
2253
- id: "sfixed32.lt"
2254
- expression:
2255
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
2256
- "? 'value must be less than %s'.format([rules.lt]) : ''"
2257
- }];
2258
-
2259
- // `lte` requires the field value to be less than or equal to the specified
2260
- // value (field <= value). If the field value is greater than the specified
2261
- // value, an error message is generated.
2262
- //
2263
- // ```proto
2264
- // message MySFixed32 {
2265
- // // value must be less than or equal to 10
2266
- // sfixed32 value = 1 [(buf.validate.field).sfixed32.lte = 10];
2267
- // }
2268
- // ```
2269
- sfixed32 lte = 3 [(priv.field).cel = {
2270
- id: "sfixed32.lte"
2271
- expression:
2272
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
2273
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
2274
- }];
2275
- }
2276
- oneof greater_than {
2277
- // `gt` requires the field value to be greater than the specified value
2278
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
2279
- // `lte`, the range is reversed, and the field value must be outside the
2280
- // specified range. If the field value doesn't meet the required conditions,
2281
- // an error message is generated.
2282
- //
2283
- // ```proto
2284
- // message MySFixed32 {
2285
- // // value must be greater than 5 [sfixed32.gt]
2286
- // sfixed32 value = 1 [(buf.validate.field).sfixed32.gt = 5];
2287
- //
2288
- // // value must be greater than 5 and less than 10 [sfixed32.gt_lt]
2289
- // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gt: 5, lt: 10 }];
2290
- //
2291
- // // value must be greater than 10 or less than 5 [sfixed32.gt_lt_exclusive]
2292
- // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gt: 10, lt: 5 }];
2293
- // }
2294
- // ```
2295
- sfixed32 gt = 4 [
2296
- (priv.field).cel = {
2297
- id: "sfixed32.gt"
2298
- expression:
2299
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
2300
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
2301
- },
2302
- (priv.field).cel = {
2303
- id: "sfixed32.gt_lt"
2304
- expression:
2305
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
2306
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
2307
- },
2308
- (priv.field).cel = {
2309
- id: "sfixed32.gt_lt_exclusive"
2310
- expression:
2311
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
2312
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
2313
- },
2314
- (priv.field).cel = {
2315
- id: "sfixed32.gt_lte"
2316
- expression:
2317
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
2318
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
2319
- },
2320
- (priv.field).cel = {
2321
- id: "sfixed32.gt_lte_exclusive"
2322
- expression:
2323
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
2324
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
2325
- }
2326
- ];
2327
-
2328
- // `gte` requires the field value to be greater than or equal to the specified
2329
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
2330
- // or `lte`, the range is reversed, and the field value must be outside the
2331
- // specified range. If the field value doesn't meet the required conditions,
2332
- // an error message is generated.
2333
- //
2334
- // ```proto
2335
- // message MySFixed32 {
2336
- // // value must be greater than or equal to 5 [sfixed32.gte]
2337
- // sfixed32 value = 1 [(buf.validate.field).sfixed32.gte = 5];
2338
- //
2339
- // // value must be greater than or equal to 5 and less than 10 [sfixed32.gte_lt]
2340
- // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gte: 5, lt: 10 }];
2341
- //
2342
- // // value must be greater than or equal to 10 or less than 5 [sfixed32.gte_lt_exclusive]
2343
- // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gte: 10, lt: 5 }];
2344
- // }
2345
- // ```
2346
- sfixed32 gte = 5 [
2347
- (priv.field).cel = {
2348
- id: "sfixed32.gte"
2349
- expression:
2350
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
2351
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
2352
- },
2353
- (priv.field).cel = {
2354
- id: "sfixed32.gte_lt"
2355
- expression:
2356
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
2357
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
2358
- },
2359
- (priv.field).cel = {
2360
- id: "sfixed32.gte_lt_exclusive"
2361
- expression:
2362
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
2363
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
2364
- },
2365
- (priv.field).cel = {
2366
- id: "sfixed32.gte_lte"
2367
- expression:
2368
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
2369
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
2370
- },
2371
- (priv.field).cel = {
2372
- id: "sfixed32.gte_lte_exclusive"
2373
- expression:
2374
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
2375
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
2376
- }
2377
- ];
2378
- }
2379
-
2380
- // `in` requires the field value to be equal to one of the specified values.
2381
- // If the field value isn't one of the specified values, an error message is
2382
- // generated.
2383
- //
2384
- // ```proto
2385
- // message MySFixed32 {
2386
- // // value must be in list [1, 2, 3]
2387
- // repeated sfixed32 value = 1 (buf.validate.field).sfixed32 = { in: [1, 2, 3] };
2388
- // }
2389
- // ```
2390
- repeated sfixed32 in = 6 [(priv.field).cel = {
2391
- id: "sfixed32.in"
2392
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
2393
- }];
2394
-
2395
- // `not_in` requires the field value to not be equal to any of the specified
2396
- // values. If the field value is one of the specified values, an error
2397
- // message is generated.
2398
- //
2399
- // ```proto
2400
- // message MySFixed32 {
2401
- // // value must not be in list [1, 2, 3]
2402
- // repeated sfixed32 value = 1 (buf.validate.field).sfixed32 = { not_in: [1, 2, 3] };
2403
- // }
2404
- // ```
2405
- repeated sfixed32 not_in = 7 [(priv.field).cel = {
2406
- id: "sfixed32.not_in"
2407
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
2408
- }];
2409
- }
2410
-
2411
- // SFixed64Rules describes the constraints applied to `fixed64` values.
2412
- message SFixed64Rules {
2413
- // `const` requires the field value to exactly match the specified value. If
2414
- // the field value doesn't match, an error message is generated.
2415
- //
2416
- // ```proto
2417
- // message MySFixed64 {
2418
- // // value must equal 42
2419
- // sfixed64 value = 1 [(buf.validate.field).sfixed64.const = 42];
2420
- // }
2421
- // ```
2422
- optional sfixed64 const = 1 [(priv.field).cel = {
2423
- id: "sfixed64.const"
2424
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
2425
- }];
2426
- oneof less_than {
2427
- // `lt` requires the field value to be less than the specified value (field <
2428
- // value). If the field value is equal to or greater than the specified value,
2429
- // an error message is generated.
2430
- //
2431
- // ```proto
2432
- // message MySFixed64 {
2433
- // // value must be less than 10
2434
- // sfixed64 value = 1 [(buf.validate.field).sfixed64.lt = 10];
2435
- // }
2436
- // ```
2437
- sfixed64 lt = 2 [(priv.field).cel = {
2438
- id: "sfixed64.lt"
2439
- expression:
2440
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
2441
- "? 'value must be less than %s'.format([rules.lt]) : ''"
2442
- }];
2443
-
2444
- // `lte` requires the field value to be less than or equal to the specified
2445
- // value (field <= value). If the field value is greater than the specified
2446
- // value, an error message is generated.
2447
- //
2448
- // ```proto
2449
- // message MySFixed64 {
2450
- // // value must be less than or equal to 10
2451
- // sfixed64 value = 1 [(buf.validate.field).sfixed64.lte = 10];
2452
- // }
2453
- // ```
2454
- sfixed64 lte = 3 [(priv.field).cel = {
2455
- id: "sfixed64.lte"
2456
- expression:
2457
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
2458
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
2459
- }];
2460
- }
2461
- oneof greater_than {
2462
- // `gt` requires the field value to be greater than the specified value
2463
- // (exclusive). If the value of `gt` is larger than a specified `lt` or
2464
- // `lte`, the range is reversed, and the field value must be outside the
2465
- // specified range. If the field value doesn't meet the required conditions,
2466
- // an error message is generated.
2467
- //
2468
- // ```proto
2469
- // message MySFixed64 {
2470
- // // value must be greater than 5 [sfixed64.gt]
2471
- // sfixed64 value = 1 [(buf.validate.field).sfixed64.gt = 5];
2472
- //
2473
- // // value must be greater than 5 and less than 10 [sfixed64.gt_lt]
2474
- // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gt: 5, lt: 10 }];
2475
- //
2476
- // // value must be greater than 10 or less than 5 [sfixed64.gt_lt_exclusive]
2477
- // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gt: 10, lt: 5 }];
2478
- // }
2479
- // ```
2480
- sfixed64 gt = 4 [
2481
- (priv.field).cel = {
2482
- id: "sfixed64.gt"
2483
- expression:
2484
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
2485
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
2486
- },
2487
- (priv.field).cel = {
2488
- id: "sfixed64.gt_lt"
2489
- expression:
2490
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
2491
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
2492
- },
2493
- (priv.field).cel = {
2494
- id: "sfixed64.gt_lt_exclusive"
2495
- expression:
2496
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
2497
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
2498
- },
2499
- (priv.field).cel = {
2500
- id: "sfixed64.gt_lte"
2501
- expression:
2502
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
2503
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
2504
- },
2505
- (priv.field).cel = {
2506
- id: "sfixed64.gt_lte_exclusive"
2507
- expression:
2508
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
2509
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
2510
- }
2511
- ];
2512
-
2513
- // `gte` requires the field value to be greater than or equal to the specified
2514
- // value (exclusive). If the value of `gte` is larger than a specified `lt`
2515
- // or `lte`, the range is reversed, and the field value must be outside the
2516
- // specified range. If the field value doesn't meet the required conditions,
2517
- // an error message is generated.
2518
- //
2519
- // ```proto
2520
- // message MySFixed64 {
2521
- // // value must be greater than or equal to 5 [sfixed64.gte]
2522
- // sfixed64 value = 1 [(buf.validate.field).sfixed64.gte = 5];
2523
- //
2524
- // // value must be greater than or equal to 5 and less than 10 [sfixed64.gte_lt]
2525
- // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gte: 5, lt: 10 }];
2526
- //
2527
- // // value must be greater than or equal to 10 or less than 5 [sfixed64.gte_lt_exclusive]
2528
- // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gte: 10, lt: 5 }];
2529
- // }
2530
- // ```
2531
- sfixed64 gte = 5 [
2532
- (priv.field).cel = {
2533
- id: "sfixed64.gte"
2534
- expression:
2535
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
2536
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
2537
- },
2538
- (priv.field).cel = {
2539
- id: "sfixed64.gte_lt"
2540
- expression:
2541
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
2542
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
2543
- },
2544
- (priv.field).cel = {
2545
- id: "sfixed64.gte_lt_exclusive"
2546
- expression:
2547
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
2548
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
2549
- },
2550
- (priv.field).cel = {
2551
- id: "sfixed64.gte_lte"
2552
- expression:
2553
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
2554
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
2555
- },
2556
- (priv.field).cel = {
2557
- id: "sfixed64.gte_lte_exclusive"
2558
- expression:
2559
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
2560
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
2561
- }
2562
- ];
2563
- }
2564
-
2565
- // `in` requires the field value to be equal to one of the specified values.
2566
- // If the field value isn't one of the specified values, an error message is
2567
- // generated.
2568
- //
2569
- // ```proto
2570
- // message MySFixed64 {
2571
- // // value must be in list [1, 2, 3]
2572
- // repeated sfixed64 value = 1 (buf.validate.field).sfixed64 = { in: [1, 2, 3] };
2573
- // }
2574
- // ```
2575
- repeated sfixed64 in = 6 [(priv.field).cel = {
2576
- id: "sfixed64.in"
2577
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
2578
- }];
2579
-
2580
- // `not_in` requires the field value to not be equal to any of the specified
2581
- // values. If the field value is one of the specified values, an error
2582
- // message is generated.
2583
- //
2584
- // ```proto
2585
- // message MySFixed64 {
2586
- // // value must not be in list [1, 2, 3]
2587
- // repeated sfixed64 value = 1 (buf.validate.field).sfixed64 = { not_in: [1, 2, 3] };
2588
- // }
2589
- // ```
2590
- repeated sfixed64 not_in = 7 [(priv.field).cel = {
2591
- id: "sfixed64.not_in"
2592
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
2593
- }];
2594
- }
2595
-
2596
- // BoolRules describes the constraints applied to `bool` values. These rules
2597
- // may also be applied to the `google.protobuf.BoolValue` Well-Known-Type.
2598
- message BoolRules {
2599
- // `const` requires the field value to exactly match the specified boolean value.
2600
- // If the field value doesn't match, an error message is generated.
2601
- //
2602
- // ```proto
2603
- // message MyBool {
2604
- // // value must equal true
2605
- // bool value = 1 [(buf.validate.field).bool.const = true];
2606
- // }
2607
- // ```
2608
- optional bool const = 1 [(priv.field).cel = {
2609
- id: "bool.const"
2610
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
2611
- }];
2612
- }
2613
-
2614
- // StringRules describes the constraints applied to `string` values These
2615
- // rules may also be applied to the `google.protobuf.StringValue` Well-Known-Type.
2616
- message StringRules {
2617
- // `const` requires the field value to exactly match the specified value. If
2618
- // the field value doesn't match, an error message is generated.
2619
- //
2620
- // ```proto
2621
- // message MyString {
2622
- // // value must equal `hello`
2623
- // string value = 1 [(buf.validate.field).string.const = "hello"];
2624
- // }
2625
- // ```
2626
- optional string const = 1 [(priv.field).cel = {
2627
- id: "string.const"
2628
- expression: "this != rules.const ? 'value must equal `%s`'.format([rules.const]) : ''"
2629
- }];
2630
-
2631
- // `len` dictates that the field value must have the specified
2632
- // number of characters (Unicode code points), which may differ from the number
2633
- // of bytes in the string. If the field value does not meet the specified
2634
- // length, an error message will be generated.
2635
- //
2636
- // ```proto
2637
- // message MyString {
2638
- // // value length must be 5 characters
2639
- // string value = 1 [(buf.validate.field).string.len = 5];
2640
- // }
2641
- // ```
2642
- optional uint64 len = 19 [(priv.field).cel = {
2643
- id: "string.len"
2644
- expression: "uint(this.size()) != rules.len ? 'value length must be %s characters'.format([rules.len]) : ''"
2645
- }];
2646
-
2647
- // `min_len` specifies that the field value must have at least the specified
2648
- // number of characters (Unicode code points), which may differ from the number
2649
- // of bytes in the string. If the field value contains fewer characters, an error
2650
- // message will be generated.
2651
- //
2652
- // ```proto
2653
- // message MyString {
2654
- // // value length must be at least 3 characters
2655
- // string value = 1 [(buf.validate.field).string.min_len = 3];
2656
- // }
2657
- // ```
2658
- optional uint64 min_len = 2 [(priv.field).cel = {
2659
- id: "string.min_len"
2660
- expression: "uint(this.size()) < rules.min_len ? 'value length must be at least %s characters'.format([rules.min_len]) : ''"
2661
- }];
2662
-
2663
- // `max_len` specifies that the field value must have no more than the specified
2664
- // number of characters (Unicode code points), which may differ from the
2665
- // number of bytes in the string. If the field value contains more characters,
2666
- // an error message will be generated.
2667
- //
2668
- // ```proto
2669
- // message MyString {
2670
- // // value length must be at most 10 characters
2671
- // string value = 1 [(buf.validate.field).string.max_len = 10];
2672
- // }
2673
- // ```
2674
- optional uint64 max_len = 3 [(priv.field).cel = {
2675
- id: "string.max_len"
2676
- expression: "uint(this.size()) > rules.max_len ? 'value length must be at most %s characters'.format([rules.max_len]) : ''"
2677
- }];
2678
-
2679
- // `len_bytes` dictates that the field value must have the specified number of
2680
- // bytes. If the field value does not match the specified length in bytes,
2681
- // an error message will be generated.
2682
- //
2683
- // ```proto
2684
- // message MyString {
2685
- // // value length must be 6 bytes
2686
- // string value = 1 [(buf.validate.field).string.len_bytes = 6];
2687
- // }
2688
- // ```
2689
- optional uint64 len_bytes = 20 [(priv.field).cel = {
2690
- id: "string.len_bytes"
2691
- expression: "uint(bytes(this).size()) != rules.len_bytes ? 'value length must be %s bytes'.format([rules.len_bytes]) : ''"
2692
- }];
2693
-
2694
- // `min_bytes` specifies that the field value must have at least the specified
2695
- // number of bytes. If the field value contains fewer bytes, an error message
2696
- // will be generated.
2697
- //
2698
- // ```proto
2699
- // message MyString {
2700
- // // value length must be at least 4 bytes
2701
- // string value = 1 [(buf.validate.field).string.min_bytes = 4];
2702
- // }
2703
- //
2704
- // ```
2705
- optional uint64 min_bytes = 4 [(priv.field).cel = {
2706
- id: "string.min_bytes"
2707
- expression: "uint(bytes(this).size()) < rules.min_bytes ? 'value length must be at least %s bytes'.format([rules.min_bytes]) : ''"
2708
- }];
2709
-
2710
- // `max_bytes` specifies that the field value must have no more than the
2711
- //specified number of bytes. If the field value contains more bytes, an
2712
- // error message will be generated.
2713
- //
2714
- // ```proto
2715
- // message MyString {
2716
- // // value length must be at most 8 bytes
2717
- // string value = 1 [(buf.validate.field).string.max_bytes = 8];
2718
- // }
2719
- // ```
2720
- optional uint64 max_bytes = 5 [(priv.field).cel = {
2721
- id: "string.max_bytes"
2722
- expression: "uint(bytes(this).size()) > rules.max_bytes ? 'value length must be at most %s bytes'.format([rules.max_bytes]) : ''"
2723
- }];
2724
-
2725
- // `pattern` specifies that the field value must match the specified
2726
- // regular expression (RE2 syntax), with the expression provided without any
2727
- // delimiters. If the field value doesn't match the regular expression, an
2728
- // error message will be generated.
2729
- //
2730
- // ```proto
2731
- // message MyString {
2732
- // // value does not match regex pattern `^[a-zA-Z]//$`
2733
- // string value = 1 [(buf.validate.field).string.pattern = "^[a-zA-Z]//$"];
2734
- // }
2735
- // ```
2736
- optional string pattern = 6 [(priv.field).cel = {
2737
- id: "string.pattern"
2738
- expression: "!this.matches(rules.pattern) ? 'value does not match regex pattern `%s`'.format([rules.pattern]) : ''"
2739
- }];
2740
-
2741
- // `prefix` specifies that the field value must have the
2742
- //specified substring at the beginning of the string. If the field value
2743
- // doesn't start with the specified prefix, an error message will be
2744
- // generated.
2745
- //
2746
- // ```proto
2747
- // message MyString {
2748
- // // value does not have prefix `pre`
2749
- // string value = 1 [(buf.validate.field).string.prefix = "pre"];
2750
- // }
2751
- // ```
2752
- optional string prefix = 7 [(priv.field).cel = {
2753
- id: "string.prefix"
2754
- expression: "!this.startsWith(rules.prefix) ? 'value does not have prefix `%s`'.format([rules.prefix]) : ''"
2755
- }];
2756
-
2757
- // `suffix` specifies that the field value must have the
2758
- //specified substring at the end of the string. If the field value doesn't
2759
- // end with the specified suffix, an error message will be generated.
2760
- //
2761
- // ```proto
2762
- // message MyString {
2763
- // // value does not have suffix `post`
2764
- // string value = 1 [(buf.validate.field).string.suffix = "post"];
2765
- // }
2766
- // ```
2767
- optional string suffix = 8 [(priv.field).cel = {
2768
- id: "string.suffix"
2769
- expression: "!this.endsWith(rules.suffix) ? 'value does not have suffix `%s`'.format([rules.suffix]) : ''"
2770
- }];
2771
-
2772
- // `contains` specifies that the field value must have the
2773
- //specified substring anywhere in the string. If the field value doesn't
2774
- // contain the specified substring, an error message will be generated.
2775
- //
2776
- // ```proto
2777
- // message MyString {
2778
- // // value does not contain substring `inside`.
2779
- // string value = 1 [(buf.validate.field).string.contains = "inside"];
2780
- // }
2781
- // ```
2782
- optional string contains = 9 [(priv.field).cel = {
2783
- id: "string.contains"
2784
- expression: "!this.contains(rules.contains) ? 'value does not contain substring `%s`'.format([rules.contains]) : ''"
2785
- }];
2786
-
2787
- // `not_contains` specifies that the field value must not have the
2788
- //specified substring anywhere in the string. If the field value contains
2789
- // the specified substring, an error message will be generated.
2790
- //
2791
- // ```proto
2792
- // message MyString {
2793
- // // value contains substring `inside`.
2794
- // string value = 1 [(buf.validate.field).string.not_contains = "inside"];
2795
- // }
2796
- // ```
2797
- optional string not_contains = 23 [(priv.field).cel = {
2798
- id: "string.not_contains"
2799
- expression: "this.contains(rules.not_contains) ? 'value contains substring `%s`'.format([rules.not_contains]) : ''"
2800
- }];
2801
-
2802
- // `in` specifies that the field value must be equal to one of the specified
2803
- // values. If the field value isn't one of the specified values, an error
2804
- // message will be generated.
2805
- //
2806
- // ```proto
2807
- // message MyString {
2808
- // // value must be in list ["apple", "banana"]
2809
- // repeated string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"];
2810
- // }
2811
- // ```
2812
- repeated string in = 10 [(priv.field).cel = {
2813
- id: "string.in"
2814
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
2815
- }];
2816
-
2817
- // `not_in` specifies that the field value cannot be equal to any
2818
- // of the specified values. If the field value is one of the specified values,
2819
- // an error message will be generated.
2820
- // ```proto
2821
- // message MyString {
2822
- // // value must not be in list ["orange", "grape"]
2823
- // repeated string value = 1 [(buf.validate.field).string.not_in = "orange", (buf.validate.field).string.not_in = "grape"];
2824
- // }
2825
- // ```
2826
- repeated string not_in = 11 [(priv.field).cel = {
2827
- id: "string.not_in"
2828
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
2829
- }];
2830
-
2831
- // `WellKnown` rules provide advanced constraints against common string
2832
- // patterns
2833
- oneof well_known {
2834
- // `email` specifies that the field value must be a valid email address
2835
- // (addr-spec only) as defined by [RFC 5322](https://tools.ietf.org/html/rfc5322#section-3.4.1).
2836
- // If the field value isn't a valid email address, an error message will be generated.
2837
- //
2838
- // ```proto
2839
- // message MyString {
2840
- // // value must be a valid email address
2841
- // string value = 1 [(buf.validate.field).string.email = true];
2842
- // }
2843
- // ```
2844
- bool email = 12 [
2845
- (priv.field).cel = {
2846
- id: "string.email"
2847
- message: "value must be a valid email address"
2848
- expression: "this == '' || this.isEmail()"
2849
- },
2850
- (priv.field).cel = {
2851
- id: "string.email_empty"
2852
- message: "value is empty, which is not a valid email address"
2853
- expression: "this != ''"
2854
- }
2855
- ];
2856
-
2857
- // `hostname` specifies that the field value must be a valid
2858
- // hostname as defined by [RFC 1034](https://tools.ietf.org/html/rfc1034#section-3.5). This constraint doesn't support
2859
- // internationalized domain names (IDNs). If the field value isn't a
2860
- // valid hostname, an error message will be generated.
2861
- //
2862
- // ```proto
2863
- // message MyString {
2864
- // // value must be a valid hostname
2865
- // string value = 1 [(buf.validate.field).string.hostname = true];
2866
- // }
2867
- // ```
2868
- bool hostname = 13 [
2869
- (priv.field).cel = {
2870
- id: "string.hostname"
2871
- message: "value must be a valid hostname"
2872
- expression: "this == '' || this.isHostname()"
2873
- },
2874
- (priv.field).cel = {
2875
- id: "string.hostname_empty"
2876
- message: "value is empty, which is not a valid hostname"
2877
- expression: "this != ''"
2878
- }
2879
- ];
2880
-
2881
- // `ip` specifies that the field value must be a valid IP
2882
- // (v4 or v6) address, without surrounding square brackets for IPv6 addresses.
2883
- // If the field value isn't a valid IP address, an error message will be
2884
- // generated.
2885
- //
2886
- // ```proto
2887
- // message MyString {
2888
- // // value must be a valid IP address
2889
- // string value = 1 [(buf.validate.field).string.ip = true];
2890
- // }
2891
- // ```
2892
- bool ip = 14 [
2893
- (priv.field).cel = {
2894
- id: "string.ip"
2895
- message: "value must be a valid IP address"
2896
- expression: "this == '' || this.isIp()"
2897
- },
2898
- (priv.field).cel = {
2899
- id: "string.ip_empty"
2900
- message: "value is empty, which is not a valid IP address"
2901
- expression: "this != ''"
2902
- }
2903
- ];
2904
-
2905
- // `ipv4` specifies that the field value must be a valid IPv4
2906
- // address. If the field value isn't a valid IPv4 address, an error message
2907
- // will be generated.
2908
- //
2909
- // ```proto
2910
- // message MyString {
2911
- // // value must be a valid IPv4 address
2912
- // string value = 1 [(buf.validate.field).string.ipv4 = true];
2913
- // }
2914
- // ```
2915
- bool ipv4 = 15 [
2916
- (priv.field).cel = {
2917
- id: "string.ipv4"
2918
- message: "value must be a valid IPv4 address"
2919
- expression: "this == '' || this.isIp(4)"
2920
- },
2921
- (priv.field).cel = {
2922
- id: "string.ipv4_empty"
2923
- message: "value is empty, which is not a valid IPv4 address"
2924
- expression: "this != ''"
2925
- }
2926
- ];
2927
-
2928
- // `ipv6` specifies that the field value must be a valid
2929
- // IPv6 address, without surrounding square brackets. If the field value is
2930
- // not a valid IPv6 address, an error message will be generated.
2931
- //
2932
- // ```proto
2933
- // message MyString {
2934
- // // value must be a valid IPv6 address
2935
- // string value = 1 [(buf.validate.field).string.ipv6 = true];
2936
- // }
2937
- // ```
2938
- bool ipv6 = 16 [
2939
- (priv.field).cel = {
2940
- id: "string.ipv6"
2941
- message: "value must be a valid IPv6 address"
2942
- expression: "this == '' || this.isIp(6)"
2943
- },
2944
- (priv.field).cel = {
2945
- id: "string.ipv6_empty"
2946
- message: "value is empty, which is not a valid IPv6 address"
2947
- expression: "this != ''"
2948
- }
2949
- ];
2950
-
2951
- // `uri` specifies that the field value must be a valid,
2952
- // absolute URI as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3). If the field value isn't a valid,
2953
- // absolute URI, an error message will be generated.
2954
- //
2955
- // ```proto
2956
- // message MyString {
2957
- // // value must be a valid URI
2958
- // string value = 1 [(buf.validate.field).string.uri = true];
2959
- // }
2960
- // ```
2961
- bool uri = 17 [
2962
- (priv.field).cel = {
2963
- id: "string.uri"
2964
- message: "value must be a valid URI"
2965
- expression: "this == '' || this.isUri()"
2966
- },
2967
- (priv.field).cel = {
2968
- id: "string.uri_empty"
2969
- message: "value is empty, which is not a valid URI"
2970
- expression: "this != ''"
2971
- }
2972
- ];
2973
-
2974
- // `uri_ref` specifies that the field value must be a valid URI
2975
- // as defined by [RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) and may be either relative or absolute. If the
2976
- // field value isn't a valid URI, an error message will be generated.
2977
- //
2978
- // ```proto
2979
- // message MyString {
2980
- // // value must be a valid URI
2981
- // string value = 1 [(buf.validate.field).string.uri_ref = true];
2982
- // }
2983
- // ```
2984
- bool uri_ref = 18 [(priv.field).cel = {
2985
- id: "string.uri_ref"
2986
- message: "value must be a valid URI"
2987
- expression: "this.isUriRef()"
2988
- }];
2989
-
2990
- // `address` specifies that the field value must be either a valid hostname
2991
- // as defined by [RFC 1034](https://tools.ietf.org/html/rfc1034#section-3.5)
2992
- // (which doesn't support internationalized domain names or IDNs) or a valid
2993
- // IP (v4 or v6). If the field value isn't a valid hostname or IP, an error
2994
- // message will be generated.
2995
- //
2996
- // ```proto
2997
- // message MyString {
2998
- // // value must be a valid hostname, or ip address
2999
- // string value = 1 [(buf.validate.field).string.address = true];
3000
- // }
3001
- // ```
3002
- bool address = 21 [
3003
- (priv.field).cel = {
3004
- id: "string.address"
3005
- message: "value must be a valid hostname, or ip address"
3006
- expression: "this == '' || this.isHostname() || this.isIp()"
3007
- },
3008
- (priv.field).cel = {
3009
- id: "string.address_empty"
3010
- message: "value is empty, which is not a valid hostname, or ip address"
3011
- expression: "this != ''"
3012
- }
3013
- ];
3014
-
3015
- // `uuid` specifies that the field value must be a valid UUID as defined by
3016
- // [RFC 4122](https://tools.ietf.org/html/rfc4122#section-4.1.2). If the
3017
- // field value isn't a valid UUID, an error message will be generated.
3018
- //
3019
- // ```proto
3020
- // message MyString {
3021
- // // value must be a valid UUID
3022
- // string value = 1 [(buf.validate.field).string.uuid = true];
3023
- // }
3024
- // ```
3025
- bool uuid = 22 [
3026
- (priv.field).cel = {
3027
- id: "string.uuid"
3028
- message: "value must be a valid UUID"
3029
- expression: "this == '' || this.matches('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$')"
3030
- },
3031
- (priv.field).cel = {
3032
- id: "string.uuid_empty"
3033
- message: "value is empty, which is not a valid UUID"
3034
- expression: "this != ''"
3035
- }
3036
- ];
3037
-
3038
- // `tuuid` (trimmed UUID) specifies that the field value must be a valid UUID as
3039
- // defined by [RFC 4122](https://tools.ietf.org/html/rfc4122#section-4.1.2) with all dashes
3040
- // omitted. If the field value isn't a valid UUID without dashes, an error message
3041
- // will be generated.
3042
- //
3043
- // ```proto
3044
- // message MyString {
3045
- // // value must be a valid trimmed UUID
3046
- // string value = 1 [(buf.validate.field).string.tuuid = true];
3047
- // }
3048
- // ```
3049
- bool tuuid = 33 [
3050
- (priv.field).cel = {
3051
- id: "string.tuuid"
3052
- message: "value must be a valid trimmed UUID"
3053
- expression: "this == '' || this.matches('^[0-9a-fA-F]{32}$')"
3054
- },
3055
- (priv.field).cel = {
3056
- id: "string.tuuid_empty"
3057
- message: "value is empty, which is not a valid trimmed UUID"
3058
- expression: "this != ''"
3059
- }
3060
- ];
3061
-
3062
- // `ip_with_prefixlen` specifies that the field value must be a valid IP (v4 or v6)
3063
- // address with prefix length. If the field value isn't a valid IP with prefix
3064
- // length, an error message will be generated.
3065
- //
3066
- //
3067
- // ```proto
3068
- // message MyString {
3069
- // // value must be a valid IP with prefix length
3070
- // string value = 1 [(buf.validate.field).string.ip_with_prefixlen = true];
3071
- // }
3072
- // ```
3073
- bool ip_with_prefixlen = 26 [
3074
- (priv.field).cel = {
3075
- id: "string.ip_with_prefixlen"
3076
- message: "value must be a valid IP prefix"
3077
- expression: "this == '' || this.isIpPrefix()"
3078
- },
3079
- (priv.field).cel = {
3080
- id: "string.ip_with_prefixlen_empty"
3081
- message: "value is empty, which is not a valid IP prefix"
3082
- expression: "this != ''"
3083
- }
3084
- ];
3085
-
3086
- // `ipv4_with_prefixlen` specifies that the field value must be a valid
3087
- // IPv4 address with prefix.
3088
- // If the field value isn't a valid IPv4 address with prefix length,
3089
- // an error message will be generated.
3090
- //
3091
- // ```proto
3092
- // message MyString {
3093
- // // value must be a valid IPv4 address with prefix length
3094
- // string value = 1 [(buf.validate.field).string.ipv4_with_prefixlen = true];
3095
- // }
3096
- // ```
3097
- bool ipv4_with_prefixlen = 27 [
3098
- (priv.field).cel = {
3099
- id: "string.ipv4_with_prefixlen"
3100
- message: "value must be a valid IPv4 address with prefix length"
3101
- expression: "this == '' || this.isIpPrefix(4)"
3102
- },
3103
- (priv.field).cel = {
3104
- id: "string.ipv4_with_prefixlen_empty"
3105
- message: "value is empty, which is not a valid IPv4 address with prefix length"
3106
- expression: "this != ''"
3107
- }
3108
- ];
3109
-
3110
- // `ipv6_with_prefixlen` specifies that the field value must be a valid
3111
- // IPv6 address with prefix length.
3112
- // If the field value is not a valid IPv6 address with prefix length,
3113
- // an error message will be generated.
3114
- //
3115
- // ```proto
3116
- // message MyString {
3117
- // // value must be a valid IPv6 address prefix length
3118
- // string value = 1 [(buf.validate.field).string.ipv6_with_prefixlen = true];
3119
- // }
3120
- // ```
3121
- bool ipv6_with_prefixlen = 28 [
3122
- (priv.field).cel = {
3123
- id: "string.ipv6_with_prefixlen"
3124
- message: "value must be a valid IPv6 address with prefix length"
3125
- expression: "this == '' || this.isIpPrefix(6)"
3126
- },
3127
- (priv.field).cel = {
3128
- id: "string.ipv6_with_prefixlen_empty"
3129
- message: "value is empty, which is not a valid IPv6 address with prefix length"
3130
- expression: "this != ''"
3131
- }
3132
- ];
3133
-
3134
- // `ip_prefix` specifies that the field value must be a valid IP (v4 or v6) prefix.
3135
- // If the field value isn't a valid IP prefix, an error message will be
3136
- // generated. The prefix must have all zeros for the masked bits of the prefix (e.g.,
3137
- // `127.0.0.0/16`, not `127.0.0.1/16`).
3138
- //
3139
- // ```proto
3140
- // message MyString {
3141
- // // value must be a valid IP prefix
3142
- // string value = 1 [(buf.validate.field).string.ip_prefix = true];
3143
- // }
3144
- // ```
3145
- bool ip_prefix = 29 [
3146
- (priv.field).cel = {
3147
- id: "string.ip_prefix"
3148
- message: "value must be a valid IP prefix"
3149
- expression: "this == '' || this.isIpPrefix(true)"
3150
- },
3151
- (priv.field).cel = {
3152
- id: "string.ip_prefix_empty"
3153
- message: "value is empty, which is not a valid IP prefix"
3154
- expression: "this != ''"
3155
- }
3156
- ];
3157
-
3158
- // `ipv4_prefix` specifies that the field value must be a valid IPv4
3159
- // prefix. If the field value isn't a valid IPv4 prefix, an error message
3160
- // will be generated. The prefix must have all zeros for the masked bits of
3161
- // the prefix (e.g., `127.0.0.0/16`, not `127.0.0.1/16`).
3162
- //
3163
- // ```proto
3164
- // message MyString {
3165
- // // value must be a valid IPv4 prefix
3166
- // string value = 1 [(buf.validate.field).string.ipv4_prefix = true];
3167
- // }
3168
- // ```
3169
- bool ipv4_prefix = 30 [
3170
- (priv.field).cel = {
3171
- id: "string.ipv4_prefix"
3172
- message: "value must be a valid IPv4 prefix"
3173
- expression: "this == '' || this.isIpPrefix(4, true)"
3174
- },
3175
- (priv.field).cel = {
3176
- id: "string.ipv4_prefix_empty"
3177
- message: "value is empty, which is not a valid IPv4 prefix"
3178
- expression: "this != ''"
3179
- }
3180
- ];
3181
-
3182
- // `ipv6_prefix` specifies that the field value must be a valid IPv6 prefix.
3183
- // If the field value is not a valid IPv6 prefix, an error message will be
3184
- // generated. The prefix must have all zeros for the masked bits of the prefix
3185
- // (e.g., `2001:db8::/48`, not `2001:db8::1/48`).
3186
- //
3187
- // ```proto
3188
- // message MyString {
3189
- // // value must be a valid IPv6 prefix
3190
- // string value = 1 [(buf.validate.field).string.ipv6_prefix = true];
3191
- // }
3192
- // ```
3193
- bool ipv6_prefix = 31 [
3194
- (priv.field).cel = {
3195
- id: "string.ipv6_prefix"
3196
- message: "value must be a valid IPv6 prefix"
3197
- expression: "this == '' || this.isIpPrefix(6, true)"
3198
- },
3199
- (priv.field).cel = {
3200
- id: "string.ipv6_prefix_empty"
3201
- message: "value is empty, which is not a valid IPv6 prefix"
3202
- expression: "this != ''"
3203
- }
3204
- ];
3205
-
3206
- // `host_and_port` specifies the field value must be a valid host and port
3207
- // pair. The host must be a valid hostname or IP address while the port
3208
- // must be in the range of 0-65535, inclusive. IPv6 addresses must be delimited
3209
- // with square brackets (e.g., `[::1]:1234`).
3210
- bool host_and_port = 32 [
3211
- (priv.field).cel = {
3212
- id: "string.host_and_port"
3213
- message: "value must be a valid host (hostname or IP address) and port pair"
3214
- expression: "this == '' || this.isHostAndPort(true)"
3215
- },
3216
- (priv.field).cel = {
3217
- id: "string.host_and_port_empty"
3218
- message: "value is empty, which is not a valid host and port pair"
3219
- expression: "this != ''"
3220
- }
3221
- ];
3222
-
3223
- // `well_known_regex` specifies a common well-known pattern
3224
- // defined as a regex. If the field value doesn't match the well-known
3225
- // regex, an error message will be generated.
3226
- //
3227
- // ```proto
3228
- // message MyString {
3229
- // // value must be a valid HTTP header value
3230
- // string value = 1 [(buf.validate.field).string.well_known_regex = KNOWN_REGEX_HTTP_HEADER_VALUE];
3231
- // }
3232
- // ```
3233
- //
3234
- // #### KnownRegex
3235
- //
3236
- // `well_known_regex` contains some well-known patterns.
3237
- //
3238
- // | Name | Number | Description |
3239
- // |-------------------------------|--------|-------------------------------------------|
3240
- // | KNOWN_REGEX_UNSPECIFIED | 0 | |
3241
- // | KNOWN_REGEX_HTTP_HEADER_NAME | 1 | HTTP header name as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2) |
3242
- // | KNOWN_REGEX_HTTP_HEADER_VALUE | 2 | HTTP header value as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2.4) |
3243
- KnownRegex well_known_regex = 24 [
3244
- (priv.field).cel = {
3245
- id: "string.well_known_regex.header_name"
3246
- message: "value must be a valid HTTP header name"
3247
- expression:
3248
- "rules.well_known_regex != 1 || this == '' || this.matches(!has(rules.strict) || rules.strict ?"
3249
- "'^:?[0-9a-zA-Z!#$%&\\'*+-.^_|~\\x60]+$' :"
3250
- "'^[^\\u0000\\u000A\\u000D]+$')"
3251
- },
3252
- (priv.field).cel = {
3253
- id: "string.well_known_regex.header_name_empty"
3254
- message: "value is empty, which is not a valid HTTP header name"
3255
- expression: "rules.well_known_regex != 1 || this != ''"
3256
- },
3257
- (priv.field).cel = {
3258
- id: "string.well_known_regex.header_value"
3259
- message: "value must be a valid HTTP header value"
3260
- expression:
3261
- "rules.well_known_regex != 2 || this.matches(!has(rules.strict) || rules.strict ?"
3262
- "'^[^\\u0000-\\u0008\\u000A-\\u001F\\u007F]*$' :"
3263
- "'^[^\\u0000\\u000A\\u000D]*$')"
3264
- }
3265
- ];
3266
- }
3267
-
3268
- // This applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to
3269
- // enable strict header validation. By default, this is true, and HTTP header
3270
- // validations are [RFC-compliant](https://tools.ietf.org/html/rfc7230#section-3). Setting to false will enable looser
3271
- // validations that only disallow `\r\n\0` characters, which can be used to
3272
- // bypass header matching rules.
3273
- //
3274
- // ```proto
3275
- // message MyString {
3276
- // // The field `value` must have be a valid HTTP headers, but not enforced with strict rules.
3277
- // string value = 1 [(buf.validate.field).string.strict = false];
3278
- // }
3279
- // ```
3280
- optional bool strict = 25;
3281
- }
3282
-
3283
- // WellKnownRegex contain some well-known patterns.
3284
- enum KnownRegex {
3285
- KNOWN_REGEX_UNSPECIFIED = 0;
3286
-
3287
- // HTTP header name as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2).
3288
- KNOWN_REGEX_HTTP_HEADER_NAME = 1;
3289
-
3290
- // HTTP header value as defined by [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2.4).
3291
- KNOWN_REGEX_HTTP_HEADER_VALUE = 2;
3292
- }
3293
-
3294
- // BytesRules describe the constraints applied to `bytes` values. These rules
3295
- // may also be applied to the `google.protobuf.BytesValue` Well-Known-Type.
3296
- message BytesRules {
3297
- // `const` requires the field value to exactly match the specified bytes
3298
- // value. If the field value doesn't match, an error message is generated.
3299
- //
3300
- // ```proto
3301
- // message MyBytes {
3302
- // // value must be "\x01\x02\x03\x04"
3303
- // bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"];
3304
- // }
3305
- // ```
3306
- optional bytes const = 1 [(priv.field).cel = {
3307
- id: "bytes.const"
3308
- expression: "this != rules.const ? 'value must be %x'.format([rules.const]) : ''"
3309
- }];
3310
-
3311
- // `len` requires the field value to have the specified length in bytes.
3312
- // If the field value doesn't match, an error message is generated.
3313
- //
3314
- // ```proto
3315
- // message MyBytes {
3316
- // // value length must be 4 bytes.
3317
- // optional bytes value = 1 [(buf.validate.field).bytes.len = 4];
3318
- // }
3319
- // ```
3320
- optional uint64 len = 13 [(priv.field).cel = {
3321
- id: "bytes.len"
3322
- expression: "uint(this.size()) != rules.len ? 'value length must be %s bytes'.format([rules.len]) : ''"
3323
- }];
3324
-
3325
- // `min_len` requires the field value to have at least the specified minimum
3326
- // length in bytes.
3327
- // If the field value doesn't meet the requirement, an error message is generated.
3328
- //
3329
- // ```proto
3330
- // message MyBytes {
3331
- // // value length must be at least 2 bytes.
3332
- // optional bytes value = 1 [(buf.validate.field).bytes.min_len = 2];
3333
- // }
3334
- // ```
3335
- optional uint64 min_len = 2 [(priv.field).cel = {
3336
- id: "bytes.min_len"
3337
- expression: "uint(this.size()) < rules.min_len ? 'value length must be at least %s bytes'.format([rules.min_len]) : ''"
3338
- }];
3339
-
3340
- // `max_len` requires the field value to have at most the specified maximum
3341
- // length in bytes.
3342
- // If the field value exceeds the requirement, an error message is generated.
3343
- //
3344
- // ```proto
3345
- // message MyBytes {
3346
- // // value must be at most 6 bytes.
3347
- // optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6];
3348
- // }
3349
- // ```
3350
- optional uint64 max_len = 3 [(priv.field).cel = {
3351
- id: "bytes.max_len"
3352
- expression: "uint(this.size()) > rules.max_len ? 'value must be at most %s bytes'.format([rules.max_len]) : ''"
3353
- }];
3354
-
3355
- // `pattern` requires the field value to match the specified regular
3356
- // expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)).
3357
- // The value of the field must be valid UTF-8 or validation will fail with a
3358
- // runtime error.
3359
- // If the field value doesn't match the pattern, an error message is generated.
3360
- //
3361
- // ```proto
3362
- // message MyBytes {
3363
- // // value must match regex pattern "^[a-zA-Z0-9]+$".
3364
- // optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"];
3365
- // }
3366
- // ```
3367
- optional string pattern = 4 [(priv.field).cel = {
3368
- id: "bytes.pattern"
3369
- expression: "!string(this).matches(rules.pattern) ? 'value must match regex pattern `%s`'.format([rules.pattern]) : ''"
3370
- }];
3371
-
3372
- // `prefix` requires the field value to have the specified bytes at the
3373
- // beginning of the string.
3374
- // If the field value doesn't meet the requirement, an error message is generated.
3375
- //
3376
- // ```proto
3377
- // message MyBytes {
3378
- // // value does not have prefix \x01\x02
3379
- // optional bytes value = 1 [(buf.validate.field).bytes.prefix = "\x01\x02"];
3380
- // }
3381
- // ```
3382
- optional bytes prefix = 5 [(priv.field).cel = {
3383
- id: "bytes.prefix"
3384
- expression: "!this.startsWith(rules.prefix) ? 'value does not have prefix %x'.format([rules.prefix]) : ''"
3385
- }];
3386
-
3387
- // `suffix` requires the field value to have the specified bytes at the end
3388
- // of the string.
3389
- // If the field value doesn't meet the requirement, an error message is generated.
3390
- //
3391
- // ```proto
3392
- // message MyBytes {
3393
- // // value does not have suffix \x03\x04
3394
- // optional bytes value = 1 [(buf.validate.field).bytes.suffix = "\x03\x04"];
3395
- // }
3396
- // ```
3397
- optional bytes suffix = 6 [(priv.field).cel = {
3398
- id: "bytes.suffix"
3399
- expression: "!this.endsWith(rules.suffix) ? 'value does not have suffix %x'.format([rules.suffix]) : ''"
3400
- }];
3401
-
3402
- // `contains` requires the field value to have the specified bytes anywhere in
3403
- // the string.
3404
- // If the field value doesn't meet the requirement, an error message is generated.
3405
- //
3406
- // ```protobuf
3407
- // message MyBytes {
3408
- // // value does not contain \x02\x03
3409
- // optional bytes value = 1 [(buf.validate.field).bytes.contains = "\x02\x03"];
3410
- // }
3411
- // ```
3412
- optional bytes contains = 7 [(priv.field).cel = {
3413
- id: "bytes.contains"
3414
- expression: "!this.contains(rules.contains) ? 'value does not contain %x'.format([rules.contains]) : ''"
3415
- }];
3416
-
3417
- // `in` requires the field value to be equal to one of the specified
3418
- // values. If the field value doesn't match any of the specified values, an
3419
- // error message is generated.
3420
- //
3421
- // ```protobuf
3422
- // message MyBytes {
3423
- // // value must in ["\x01\x02", "\x02\x03", "\x03\x04"]
3424
- // optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}];
3425
- // }
3426
- // ```
3427
- repeated bytes in = 8 [(priv.field).cel = {
3428
- id: "bytes.in"
3429
- expression: "dyn(rules)['in'].size() > 0 && !(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
3430
- }];
3431
-
3432
- // `not_in` requires the field value to be not equal to any of the specified
3433
- // values.
3434
- // If the field value matches any of the specified values, an error message is
3435
- // generated.
3436
- //
3437
- // ```proto
3438
- // message MyBytes {
3439
- // // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"]
3440
- // optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}];
3441
- // }
3442
- // ```
3443
- repeated bytes not_in = 9 [(priv.field).cel = {
3444
- id: "bytes.not_in"
3445
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
3446
- }];
3447
-
3448
- // WellKnown rules provide advanced constraints against common byte
3449
- // patterns
3450
- oneof well_known {
3451
- // `ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format.
3452
- // If the field value doesn't meet this constraint, an error message is generated.
3453
- //
3454
- // ```proto
3455
- // message MyBytes {
3456
- // // value must be a valid IP address
3457
- // optional bytes value = 1 [(buf.validate.field).bytes.ip = true];
3458
- // }
3459
- // ```
3460
- bool ip = 10 [
3461
- (priv.field).cel = {
3462
- id: "bytes.ip"
3463
- message: "value must be a valid IP address"
3464
- expression: "this.size() == 0 || this.size() == 4 || this.size() == 16"
3465
- },
3466
- (priv.field).cel = {
3467
- id: "bytes.ip_empty"
3468
- message: "value is empty, which is not a valid IP address"
3469
- expression: "this.size() != 0"
3470
- }
3471
- ];
3472
-
3473
- // `ipv4` ensures that the field `value` is a valid IPv4 address in byte format.
3474
- // If the field value doesn't meet this constraint, an error message is generated.
3475
- //
3476
- // ```proto
3477
- // message MyBytes {
3478
- // // value must be a valid IPv4 address
3479
- // optional bytes value = 1 [(buf.validate.field).bytes.ipv4 = true];
3480
- // }
3481
- // ```
3482
- bool ipv4 = 11 [
3483
- (priv.field).cel = {
3484
- id: "bytes.ipv4"
3485
- message: "value must be a valid IPv4 address"
3486
- expression: "this.size() == 0 || this.size() == 4"
3487
- },
3488
- (priv.field).cel = {
3489
- id: "bytes.ipv4_empty"
3490
- message: "value is empty, which is not a valid IPv4 address"
3491
- expression: "this.size() != 0"
3492
- }
3493
- ];
3494
-
3495
- // `ipv6` ensures that the field `value` is a valid IPv6 address in byte format.
3496
- // If the field value doesn't meet this constraint, an error message is generated.
3497
- // ```proto
3498
- // message MyBytes {
3499
- // // value must be a valid IPv6 address
3500
- // optional bytes value = 1 [(buf.validate.field).bytes.ipv6 = true];
3501
- // }
3502
- // ```
3503
- bool ipv6 = 12 [
3504
- (priv.field).cel = {
3505
- id: "bytes.ipv6"
3506
- message: "value must be a valid IPv6 address"
3507
- expression: "this.size() == 0 || this.size() == 16"
3508
- },
3509
- (priv.field).cel = {
3510
- id: "bytes.ipv6_empty"
3511
- message: "value is empty, which is not a valid IPv6 address"
3512
- expression: "this.size() != 0"
3513
- }
3514
- ];
3515
- }
3516
- }
3517
-
3518
- // EnumRules describe the constraints applied to `enum` values.
3519
- message EnumRules {
3520
- // `const` requires the field value to exactly match the specified enum value.
3521
- // If the field value doesn't match, an error message is generated.
3522
- //
3523
- // ```proto
3524
- // enum MyEnum {
3525
- // MY_ENUM_UNSPECIFIED = 0;
3526
- // MY_ENUM_VALUE1 = 1;
3527
- // MY_ENUM_VALUE2 = 2;
3528
- // }
3529
- //
3530
- // message MyMessage {
3531
- // // The field `value` must be exactly MY_ENUM_VALUE1.
3532
- // MyEnum value = 1 [(buf.validate.field).enum.const = 1];
3533
- // }
3534
- // ```
3535
- optional int32 const = 1 [(priv.field).cel = {
3536
- id: "enum.const"
3537
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
3538
- }];
3539
-
3540
- // `defined_only` requires the field value to be one of the defined values for
3541
- // this enum, failing on any undefined value.
3542
- //
3543
- // ```proto
3544
- // enum MyEnum {
3545
- // MY_ENUM_UNSPECIFIED = 0;
3546
- // MY_ENUM_VALUE1 = 1;
3547
- // MY_ENUM_VALUE2 = 2;
3548
- // }
3549
- //
3550
- // message MyMessage {
3551
- // // The field `value` must be a defined value of MyEnum.
3552
- // MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
3553
- // }
3554
- // ```
3555
- optional bool defined_only = 2;
3556
-
3557
- // `in` requires the field value to be equal to one of the
3558
- //specified enum values. If the field value doesn't match any of the
3559
- //specified values, an error message is generated.
3560
- //
3561
- // ```proto
3562
- // enum MyEnum {
3563
- // MY_ENUM_UNSPECIFIED = 0;
3564
- // MY_ENUM_VALUE1 = 1;
3565
- // MY_ENUM_VALUE2 = 2;
3566
- // }
3567
- //
3568
- // message MyMessage {
3569
- // // The field `value` must be equal to one of the specified values.
3570
- // MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
3571
- // }
3572
- // ```
3573
- repeated int32 in = 3 [(priv.field).cel = {
3574
- id: "enum.in"
3575
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
3576
- }];
3577
-
3578
- // `not_in` requires the field value to be not equal to any of the
3579
- //specified enum values. If the field value matches one of the specified
3580
- // values, an error message is generated.
3581
- //
3582
- // ```proto
3583
- // enum MyEnum {
3584
- // MY_ENUM_UNSPECIFIED = 0;
3585
- // MY_ENUM_VALUE1 = 1;
3586
- // MY_ENUM_VALUE2 = 2;
3587
- // }
3588
- //
3589
- // message MyMessage {
3590
- // // The field `value` must not be equal to any of the specified values.
3591
- // MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
3592
- // }
3593
- // ```
3594
- repeated int32 not_in = 4 [(priv.field).cel = {
3595
- id: "enum.not_in"
3596
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
3597
- }];
3598
- }
3599
-
3600
- // RepeatedRules describe the constraints applied to `repeated` values.
3601
- message RepeatedRules {
3602
- // `min_items` requires that this field must contain at least the specified
3603
- // minimum number of items.
3604
- //
3605
- // Note that `min_items = 1` is equivalent to setting a field as `required`.
3606
- //
3607
- // ```proto
3608
- // message MyRepeated {
3609
- // // value must contain at least 2 items
3610
- // repeated string value = 1 [(buf.validate.field).repeated.min_items = 2];
3611
- // }
3612
- // ```
3613
- optional uint64 min_items = 1 [(priv.field).cel = {
3614
- id: "repeated.min_items"
3615
- expression: "uint(this.size()) < rules.min_items ? 'value must contain at least %d item(s)'.format([rules.min_items]) : ''"
3616
- }];
3617
-
3618
- // `max_items` denotes that this field must not exceed a
3619
- // certain number of items as the upper limit. If the field contains more
3620
- // items than specified, an error message will be generated, requiring the
3621
- // field to maintain no more than the specified number of items.
3622
- //
3623
- // ```proto
3624
- // message MyRepeated {
3625
- // // value must contain no more than 3 item(s)
3626
- // repeated string value = 1 [(buf.validate.field).repeated.max_items = 3];
3627
- // }
3628
- // ```
3629
- optional uint64 max_items = 2 [(priv.field).cel = {
3630
- id: "repeated.max_items"
3631
- expression: "uint(this.size()) > rules.max_items ? 'value must contain no more than %s item(s)'.format([rules.max_items]) : ''"
3632
- }];
3633
-
3634
- // `unique` indicates that all elements in this field must
3635
- // be unique. This constraint is strictly applicable to scalar and enum
3636
- // types, with message types not being supported.
3637
- //
3638
- // ```proto
3639
- // message MyRepeated {
3640
- // // repeated value must contain unique items
3641
- // repeated string value = 1 [(buf.validate.field).repeated.unique = true];
3642
- // }
3643
- // ```
3644
- optional bool unique = 3 [(priv.field).cel = {
3645
- id: "repeated.unique"
3646
- message: "repeated value must contain unique items"
3647
- expression: "this.unique()"
3648
- }];
3649
-
3650
- // `items` details the constraints to be applied to each item
3651
- // in the field. Even for repeated message fields, validation is executed
3652
- // against each item unless skip is explicitly specified.
3653
- //
3654
- // ```proto
3655
- // message MyRepeated {
3656
- // // The items in the field `value` must follow the specified constraints.
3657
- // repeated string value = 1 [(buf.validate.field).repeated.items = {
3658
- // string: {
3659
- // min_len: 3
3660
- // max_len: 10
3661
- // }
3662
- // }];
3663
- // }
3664
- // ```
3665
- optional FieldConstraints items = 4;
3666
- }
3667
-
3668
- // MapRules describe the constraints applied to `map` values.
3669
- message MapRules {
3670
- //Specifies the minimum number of key-value pairs allowed. If the field has
3671
- // fewer key-value pairs than specified, an error message is generated.
3672
- //
3673
- // ```proto
3674
- // message MyMap {
3675
- // // The field `value` must have at least 2 key-value pairs.
3676
- // map<string, string> value = 1 [(buf.validate.field).map.min_pairs = 2];
3677
- // }
3678
- // ```
3679
- optional uint64 min_pairs = 1 [(priv.field).cel = {
3680
- id: "map.min_pairs"
3681
- expression: "uint(this.size()) < rules.min_pairs ? 'map must be at least %d entries'.format([rules.min_pairs]) : ''"
3682
- }];
3683
-
3684
- //Specifies the maximum number of key-value pairs allowed. If the field has
3685
- // more key-value pairs than specified, an error message is generated.
3686
- //
3687
- // ```proto
3688
- // message MyMap {
3689
- // // The field `value` must have at most 3 key-value pairs.
3690
- // map<string, string> value = 1 [(buf.validate.field).map.max_pairs = 3];
3691
- // }
3692
- // ```
3693
- optional uint64 max_pairs = 2 [(priv.field).cel = {
3694
- id: "map.max_pairs"
3695
- expression: "uint(this.size()) > rules.max_pairs ? 'map must be at most %d entries'.format([rules.max_pairs]) : ''"
3696
- }];
3697
-
3698
- //Specifies the constraints to be applied to each key in the field.
3699
- //
3700
- // ```proto
3701
- // message MyMap {
3702
- // // The keys in the field `value` must follow the specified constraints.
3703
- // map<string, string> value = 1 [(buf.validate.field).map.keys = {
3704
- // string: {
3705
- // min_len: 3
3706
- // max_len: 10
3707
- // }
3708
- // }];
3709
- // }
3710
- // ```
3711
- optional FieldConstraints keys = 4;
3712
-
3713
- //Specifies the constraints to be applied to the value of each key in the
3714
- // field. Message values will still have their validations evaluated unless
3715
- //skip is specified here.
3716
- //
3717
- // ```proto
3718
- // message MyMap {
3719
- // // The values in the field `value` must follow the specified constraints.
3720
- // map<string, string> value = 1 [(buf.validate.field).map.values = {
3721
- // string: {
3722
- // min_len: 5
3723
- // max_len: 20
3724
- // }
3725
- // }];
3726
- // }
3727
- // ```
3728
- optional FieldConstraints values = 5;
3729
- }
3730
-
3731
- // AnyRules describe constraints applied exclusively to the `google.protobuf.Any` well-known type.
3732
- message AnyRules {
3733
- // `in` requires the field's `type_url` to be equal to one of the
3734
- //specified values. If it doesn't match any of the specified values, an error
3735
- // message is generated.
3736
- //
3737
- // ```proto
3738
- // message MyAny {
3739
- // // The `value` field must have a `type_url` equal to one of the specified values.
3740
- // google.protobuf.Any value = 1 [(buf.validate.field).any.in = ["type.googleapis.com/MyType1", "type.googleapis.com/MyType2"]];
3741
- // }
3742
- // ```
3743
- repeated string in = 2;
3744
-
3745
- // requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated.
3746
- //
3747
- // ```proto
3748
- // message MyAny {
3749
- // // The field `value` must not have a `type_url` equal to any of the specified values.
3750
- // google.protobuf.Any value = 1 [(buf.validate.field).any.not_in = ["type.googleapis.com/ForbiddenType1", "type.googleapis.com/ForbiddenType2"]];
3751
- // }
3752
- // ```
3753
- repeated string not_in = 3;
3754
- }
3755
-
3756
- // DurationRules describe the constraints applied exclusively to the `google.protobuf.Duration` well-known type.
3757
- message DurationRules {
3758
- // `const` dictates that the field must match the specified value of the `google.protobuf.Duration` type exactly.
3759
- // If the field's value deviates from the specified value, an error message
3760
- // will be generated.
3761
- //
3762
- // ```proto
3763
- // message MyDuration {
3764
- // // value must equal 5s
3765
- // google.protobuf.Duration value = 1 [(buf.validate.field).duration.const = "5s"];
3766
- // }
3767
- // ```
3768
- optional google.protobuf.Duration const = 2 [(priv.field).cel = {
3769
- id: "duration.const"
3770
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
3771
- }];
3772
- oneof less_than {
3773
- // `lt` stipulates that the field must be less than the specified value of the `google.protobuf.Duration` type,
3774
- // exclusive. If the field's value is greater than or equal to the specified
3775
- // value, an error message will be generated.
3776
- //
3777
- // ```proto
3778
- // message MyDuration {
3779
- // // value must be less than 5s
3780
- // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = "5s"];
3781
- // }
3782
- // ```
3783
- google.protobuf.Duration lt = 3 [(priv.field).cel = {
3784
- id: "duration.lt"
3785
- expression:
3786
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
3787
- "? 'value must be less than %s'.format([rules.lt]) : ''"
3788
- }];
3789
-
3790
- // `lte` indicates that the field must be less than or equal to the specified
3791
- // value of the `google.protobuf.Duration` type, inclusive. If the field's value is greater than the specified value,
3792
- // an error message will be generated.
3793
- //
3794
- // ```proto
3795
- // message MyDuration {
3796
- // // value must be less than or equal to 10s
3797
- // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lte = "10s"];
3798
- // }
3799
- // ```
3800
- google.protobuf.Duration lte = 4 [(priv.field).cel = {
3801
- id: "duration.lte"
3802
- expression:
3803
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
3804
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
3805
- }];
3806
- }
3807
- oneof greater_than {
3808
- // `gt` requires the duration field value to be greater than the specified
3809
- // value (exclusive). If the value of `gt` is larger than a specified `lt`
3810
- // or `lte`, the range is reversed, and the field value must be outside the
3811
- // specified range. If the field value doesn't meet the required conditions,
3812
- // an error message is generated.
3813
- //
3814
- // ```proto
3815
- // message MyDuration {
3816
- // // duration must be greater than 5s [duration.gt]
3817
- // google.protobuf.Duration value = 1 [(buf.validate.field).duration.gt = { seconds: 5 }];
3818
- //
3819
- // // duration must be greater than 5s and less than 10s [duration.gt_lt]
3820
- // google.protobuf.Duration another_value = 2 [(buf.validate.field).duration = { gt: { seconds: 5 }, lt: { seconds: 10 } }];
3821
- //
3822
- // // duration must be greater than 10s or less than 5s [duration.gt_lt_exclusive]
3823
- // google.protobuf.Duration other_value = 3 [(buf.validate.field).duration = { gt: { seconds: 10 }, lt: { seconds: 5 } }];
3824
- // }
3825
- // ```
3826
- google.protobuf.Duration gt = 5 [
3827
- (priv.field).cel = {
3828
- id: "duration.gt"
3829
- expression:
3830
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
3831
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
3832
- },
3833
- (priv.field).cel = {
3834
- id: "duration.gt_lt"
3835
- expression:
3836
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
3837
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
3838
- },
3839
- (priv.field).cel = {
3840
- id: "duration.gt_lt_exclusive"
3841
- expression:
3842
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
3843
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
3844
- },
3845
- (priv.field).cel = {
3846
- id: "duration.gt_lte"
3847
- expression:
3848
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
3849
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
3850
- },
3851
- (priv.field).cel = {
3852
- id: "duration.gt_lte_exclusive"
3853
- expression:
3854
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
3855
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
3856
- }
3857
- ];
3858
-
3859
- // `gte` requires the duration field value to be greater than or equal to the
3860
- // specified value (exclusive). If the value of `gte` is larger than a
3861
- // specified `lt` or `lte`, the range is reversed, and the field value must
3862
- // be outside the specified range. If the field value doesn't meet the
3863
- // required conditions, an error message is generated.
3864
- //
3865
- // ```proto
3866
- // message MyDuration {
3867
- // // duration must be greater than or equal to 5s [duration.gte]
3868
- // google.protobuf.Duration value = 1 [(buf.validate.field).duration.gte = { seconds: 5 }];
3869
- //
3870
- // // duration must be greater than or equal to 5s and less than 10s [duration.gte_lt]
3871
- // google.protobuf.Duration another_value = 2 [(buf.validate.field).duration = { gte: { seconds: 5 }, lt: { seconds: 10 } }];
3872
- //
3873
- // // duration must be greater than or equal to 10s or less than 5s [duration.gte_lt_exclusive]
3874
- // google.protobuf.Duration other_value = 3 [(buf.validate.field).duration = { gte: { seconds: 10 }, lt: { seconds: 5 } }];
3875
- // }
3876
- // ```
3877
- google.protobuf.Duration gte = 6 [
3878
- (priv.field).cel = {
3879
- id: "duration.gte"
3880
- expression:
3881
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
3882
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
3883
- },
3884
- (priv.field).cel = {
3885
- id: "duration.gte_lt"
3886
- expression:
3887
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
3888
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
3889
- },
3890
- (priv.field).cel = {
3891
- id: "duration.gte_lt_exclusive"
3892
- expression:
3893
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
3894
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
3895
- },
3896
- (priv.field).cel = {
3897
- id: "duration.gte_lte"
3898
- expression:
3899
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
3900
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
3901
- },
3902
- (priv.field).cel = {
3903
- id: "duration.gte_lte_exclusive"
3904
- expression:
3905
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
3906
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
3907
- }
3908
- ];
3909
- }
3910
-
3911
- // `in` asserts that the field must be equal to one of the specified values of the `google.protobuf.Duration` type.
3912
- // If the field's value doesn't correspond to any of the specified values,
3913
- // an error message will be generated.
3914
- //
3915
- // ```proto
3916
- // message MyDuration {
3917
- // // value must be in list [1s, 2s, 3s]
3918
- // google.protobuf.Duration value = 1 [(buf.validate.field).duration.in = ["1s", "2s", "3s"]];
3919
- // }
3920
- // ```
3921
- repeated google.protobuf.Duration in = 7 [(priv.field).cel = {
3922
- id: "duration.in"
3923
- expression: "!(this in dyn(rules)['in']) ? 'value must be in list %s'.format([dyn(rules)['in']]) : ''"
3924
- }];
3925
-
3926
- // `not_in` denotes that the field must not be equal to
3927
- // any of the specified values of the `google.protobuf.Duration` type.
3928
- // If the field's value matches any of these values, an error message will be
3929
- // generated.
3930
- //
3931
- // ```proto
3932
- // message MyDuration {
3933
- // // value must not be in list [1s, 2s, 3s]
3934
- // google.protobuf.Duration value = 1 [(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]];
3935
- // }
3936
- // ```
3937
- repeated google.protobuf.Duration not_in = 8 [(priv.field).cel = {
3938
- id: "duration.not_in"
3939
- expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''"
3940
- }];
3941
- }
3942
-
3943
- // TimestampRules describe the constraints applied exclusively to the `google.protobuf.Timestamp` well-known type.
3944
- message TimestampRules {
3945
- // `const` dictates that this field, of the `google.protobuf.Timestamp` type, must exactly match the specified value. If the field value doesn't correspond to the specified timestamp, an error message will be generated.
3946
- //
3947
- // ```proto
3948
- // message MyTimestamp {
3949
- // // value must equal 2023-05-03T10:00:00Z
3950
- // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.const = {seconds: 1727998800}];
3951
- // }
3952
- // ```
3953
- optional google.protobuf.Timestamp const = 2 [(priv.field).cel = {
3954
- id: "timestamp.const"
3955
- expression: "this != rules.const ? 'value must equal %s'.format([rules.const]) : ''"
3956
- }];
3957
- oneof less_than {
3958
- // requires the duration field value to be less than the specified value (field < value). If the field value doesn't meet the required conditions, an error message is generated.
3959
- //
3960
- // ```proto
3961
- // message MyDuration {
3962
- // // duration must be less than 'P3D' [duration.lt]
3963
- // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = { seconds: 259200 }];
3964
- // }
3965
- // ```
3966
- google.protobuf.Timestamp lt = 3 [(priv.field).cel = {
3967
- id: "timestamp.lt"
3968
- expression:
3969
- "!has(rules.gte) && !has(rules.gt) && this >= rules.lt"
3970
- "? 'value must be less than %s'.format([rules.lt]) : ''"
3971
- }];
3972
-
3973
- // requires the timestamp field value to be less than or equal to the specified value (field <= value). If the field value doesn't meet the required conditions, an error message is generated.
3974
- //
3975
- // ```proto
3976
- // message MyTimestamp {
3977
- // // timestamp must be less than or equal to '2023-05-14T00:00:00Z' [timestamp.lte]
3978
- // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.lte = { seconds: 1678867200 }];
3979
- // }
3980
- // ```
3981
- google.protobuf.Timestamp lte = 4 [(priv.field).cel = {
3982
- id: "timestamp.lte"
3983
- expression:
3984
- "!has(rules.gte) && !has(rules.gt) && this > rules.lte"
3985
- "? 'value must be less than or equal to %s'.format([rules.lte]) : ''"
3986
- }];
3987
-
3988
- // `lt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be less than the current time. `lt_now` can only be used with the `within` rule.
3989
- //
3990
- // ```proto
3991
- // message MyTimestamp {
3992
- // // value must be less than now
3993
- // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.lt_now = true];
3994
- // }
3995
- // ```
3996
- bool lt_now = 7 [(priv.field).cel = {
3997
- id: "timestamp.lt_now"
3998
- expression: "this > now ? 'value must be less than now' : ''"
3999
- }];
4000
- }
4001
- oneof greater_than {
4002
- // `gt` requires the timestamp field value to be greater than the specified
4003
- // value (exclusive). If the value of `gt` is larger than a specified `lt`
4004
- // or `lte`, the range is reversed, and the field value must be outside the
4005
- // specified range. If the field value doesn't meet the required conditions,
4006
- // an error message is generated.
4007
- //
4008
- // ```proto
4009
- // message MyTimestamp {
4010
- // // timestamp must be greater than '2023-01-01T00:00:00Z' [timestamp.gt]
4011
- // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gt = { seconds: 1672444800 }];
4012
- //
4013
- // // timestamp must be greater than '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' [timestamp.gt_lt]
4014
- // google.protobuf.Timestamp another_value = 2 [(buf.validate.field).timestamp = { gt: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }];
4015
- //
4016
- // // timestamp must be greater than '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' [timestamp.gt_lt_exclusive]
4017
- // google.protobuf.Timestamp other_value = 3 [(buf.validate.field).timestamp = { gt: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }];
4018
- // }
4019
- // ```
4020
- google.protobuf.Timestamp gt = 5 [
4021
- (priv.field).cel = {
4022
- id: "timestamp.gt"
4023
- expression:
4024
- "!has(rules.lt) && !has(rules.lte) && this <= rules.gt"
4025
- "? 'value must be greater than %s'.format([rules.gt]) : ''"
4026
- },
4027
- (priv.field).cel = {
4028
- id: "timestamp.gt_lt"
4029
- expression:
4030
- "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)"
4031
- "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''"
4032
- },
4033
- (priv.field).cel = {
4034
- id: "timestamp.gt_lt_exclusive"
4035
- expression:
4036
- "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)"
4037
- "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''"
4038
- },
4039
- (priv.field).cel = {
4040
- id: "timestamp.gt_lte"
4041
- expression:
4042
- "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)"
4043
- "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
4044
- },
4045
- (priv.field).cel = {
4046
- id: "timestamp.gt_lte_exclusive"
4047
- expression:
4048
- "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)"
4049
- "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''"
4050
- }
4051
- ];
4052
-
4053
- // `gte` requires the timestamp field value to be greater than or equal to the
4054
- // specified value (exclusive). If the value of `gte` is larger than a
4055
- // specified `lt` or `lte`, the range is reversed, and the field value
4056
- // must be outside the specified range. If the field value doesn't meet
4057
- // the required conditions, an error message is generated.
4058
- //
4059
- // ```proto
4060
- // message MyTimestamp {
4061
- // // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' [timestamp.gte]
4062
- // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gte = { seconds: 1672444800 }];
4063
- //
4064
- // // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' [timestamp.gte_lt]
4065
- // google.protobuf.Timestamp another_value = 2 [(buf.validate.field).timestamp = { gte: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }];
4066
- //
4067
- // // timestamp must be greater than or equal to '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' [timestamp.gte_lt_exclusive]
4068
- // google.protobuf.Timestamp other_value = 3 [(buf.validate.field).timestamp = { gte: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }];
4069
- // }
4070
- // ```
4071
- google.protobuf.Timestamp gte = 6 [
4072
- (priv.field).cel = {
4073
- id: "timestamp.gte"
4074
- expression:
4075
- "!has(rules.lt) && !has(rules.lte) && this < rules.gte"
4076
- "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''"
4077
- },
4078
- (priv.field).cel = {
4079
- id: "timestamp.gte_lt"
4080
- expression:
4081
- "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)"
4082
- "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''"
4083
- },
4084
- (priv.field).cel = {
4085
- id: "timestamp.gte_lt_exclusive"
4086
- expression:
4087
- "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)"
4088
- "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''"
4089
- },
4090
- (priv.field).cel = {
4091
- id: "timestamp.gte_lte"
4092
- expression:
4093
- "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)"
4094
- "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
4095
- },
4096
- (priv.field).cel = {
4097
- id: "timestamp.gte_lte_exclusive"
4098
- expression:
4099
- "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)"
4100
- "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''"
4101
- }
4102
- ];
4103
-
4104
- // `gt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be greater than the current time. `gt_now` can only be used with the `within` rule.
4105
- //
4106
- // ```proto
4107
- // message MyTimestamp {
4108
- // // value must be greater than now
4109
- // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.gt_now = true];
4110
- // }
4111
- // ```
4112
- bool gt_now = 8 [(priv.field).cel = {
4113
- id: "timestamp.gt_now"
4114
- expression: "this < now ? 'value must be greater than now' : ''"
4115
- }];
4116
- }
4117
-
4118
- // `within` specifies that this field, of the `google.protobuf.Timestamp` type, must be within the specified duration of the current time. If the field value isn't within the duration, an error message is generated.
4119
- //
4120
- // ```proto
4121
- // message MyTimestamp {
4122
- // // value must be within 1 hour of now
4123
- // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.within = {seconds: 3600}];
4124
- // }
4125
- // ```
4126
- optional google.protobuf.Duration within = 9 [(priv.field).cel = {
4127
- id: "timestamp.within"
4128
- expression: "this < now-rules.within || this > now+rules.within ? 'value must be within %s of now'.format([rules.within]) : ''"
4129
- }];
4130
- }