Skip to content

Commit

Permalink
chore: Update protobufs (#42)
Browse files Browse the repository at this point in the history
Signed-off-by: Charith Ellawala <[email protected]>
  • Loading branch information
charithe authored Apr 15, 2024
1 parent cc2fd1c commit 176e9e1
Show file tree
Hide file tree
Showing 25 changed files with 7,452 additions and 1,100 deletions.
22 changes: 11 additions & 11 deletions proto/buf.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: bufbuild
repository: protovalidate
commit: e097f827e65240ac9fd4b1158849a8fc
digest: shake256:f19252436fd9ded945631e2ffaaed28247a92c9015ccf55ae99db9fb3d9600c4fdb00fd2d3bd7701026ec2fd4715c5129e6ae517c25a59ba690020cfe80bf8ad
- remote: buf.build
owner: cerbos
repository: cerbos-api
commit: 8be1b70686fe48e1945513b9fa966b66
digest: shake256:f99342ea1db4efcddbfe5476040579abc50d3be65a5a36a5b003563e85b135edab0911f0e116362fe667d5d1ec5135aed46319857db15179dabcf6a25ee8c729
- remote: buf.build
owner: envoyproxy
repository: protoc-gen-validate
commit: 6607b10f00ed4a3d98f906807131c44a
digest: shake256:acc7b2ededb2f88d296862943a003b157bdb68ec93ed13dcd8566b2d06e47993ea6daf12013b9655658aaf6bbdb141cf65bfe400ce2870f4654b0a5b45e57c09
commit: fa3315d53601494abb35a95f1232c313
digest: shake256:b2712ba97cdbf03c5111261ed409b5d77cf0c9aa2336cfb6a4f78a22f75598e3ff30efba74429cb91ef1edad3eed653f1a4a1f2741671d434846ef6db4faeb05
- remote: buf.build
owner: googleapis
repository: googleapis
commit: cc916c31859748a68fd229a3c8d7a2e8
digest: shake256:469b049d0eb04203d5272062636c078decefc96fec69739159c25d85349c50c34c7706918a8b216c5c27f76939df48452148cff8c5c3ae77fa6ba5c25c1b8bf8
commit: b30c5775bfb3485d9da2e87b26590ac9
digest: shake256:9d0caaf056949a0e1c883b9849d8a2fa66e22f18a2a48f867d1a8c700aa22abee50ad3ef0d8171637457cadc43c584998bdf3adac55da0f9e4614c72686b057d
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
commit: 11c9972ea0fd4c95a2c38d29bb1dc817
digest: shake256:9c7ce822dff52ad28714465396fbe98e879409677a61687b7dd9bb3d1484aa5d1704c013698b24f34c5d51023dbff47287ecd9676271953c25e646b42ebb76c5
commit: 3f42134f4c564983838425bc43c7a65f
digest: shake256:3d11d4c0fe5e05fda0131afefbce233940e27f0c31c5d4e385686aea58ccd30f72053f61af432fa83f1fc11cda57f5f18ca3da26a29064f73c5a0d076bba8d92
92 changes: 92 additions & 0 deletions proto/defs/buf/validate/expression.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Copyright 2023 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package buf.validate;

option go_package = "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate";
option java_multiple_files = true;
option java_outer_classname = "ExpressionProto";
option java_package = "build.buf.validate";

// `Constraint` represents a validation rule written in the Common Expression
// Language (CEL) syntax. Each Constraint includes a unique identifier, an
// optional error message, and the CEL expression to evaluate. For more
// information on CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
//
// ```proto
// message Foo {
// option (buf.validate.message).cel = {
// id: "foo.bar"
// message: "bar must be greater than 0"
// expression: "this.bar > 0"
// };
// int32 bar = 1;
// }
// ```
message Constraint {
// `id` is a string that serves as a machine-readable name for this Constraint.
// It should be unique within its scope, which could be either a message or a field.
string id = 1;

// `message` is an optional field that provides a human-readable error message
// for this Constraint when the CEL expression evaluates to false. If a
// non-empty message is provided, any strings resulting from the CEL
// expression evaluation are ignored.
string message = 2;

// `expression` is the actual CEL expression that will be evaluated for
// validation. This string must resolve to either a boolean or a string
// value. If the expression evaluates to false or a non-empty string, the
// validation is considered failed, and the message is rejected.
string expression = 3;
}

// `Violations` is a collection of `Violation` messages. This message type is returned by
// protovalidate when a proto message fails to meet the requirements set by the `Constraint` validation rules.
// Each individual violation is represented by a `Violation` message.
message Violations {
// `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected.
repeated Violation violations = 1;
}

// `Violation` represents a single instance where a validation rule, expressed
// as a `Constraint`, was not met. It provides information about the field that
// caused the violation, the specific constraint that wasn't fulfilled, and a
// human-readable error message.
//
// ```json
// {
// "fieldPath": "bar",
// "constraintId": "foo.bar",
// "message": "bar must be greater than 0"
// }
// ```
message Violation {
// `field_path` is a machine-readable identifier that points to the specific field that failed the validation.
// This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
string field_path = 1;

// `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.
// This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
string constraint_id = 2;

// `message` is a human-readable error message that describes the nature of the violation.
// This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
string message = 3;

// `for_key` indicates whether the violation was caused by a map key, rather than a value.
bool for_key = 4;
}
41 changes: 41 additions & 0 deletions proto/defs/buf/validate/priv/private.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2023 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package buf.validate.priv;

import "google/protobuf/descriptor.proto";

option go_package = "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate/priv";
option java_multiple_files = true;
option java_outer_classname = "PrivateProto";
option java_package = "build.buf.validate.priv";

extend google.protobuf.FieldOptions {
// Do not use. Internal to protovalidate library
optional FieldConstraints field = 1160;
}

// Do not use. Internal to protovalidate library
message FieldConstraints {
repeated Constraint cel = 1;
}

// Do not use. Internal to protovalidate library
message Constraint {
string id = 1;
string message = 2;
string expression = 3;
}
Loading

0 comments on commit 176e9e1

Please sign in to comment.