Skip to content

Commit c631608

Browse files
Merge branch 'main' into jrinehart/dvrl-518-update-links-in-all-protovalidate-github-repos-to-use
2 parents 0ab8b31 + b7bd55c commit c631608

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

README.md

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
1-
[![The Buf logo](.github/buf-logo.svg)][buf]
1+
[![The Buf logo](.github/buf-logo.svg)][buf]
22

33
# protovalidate-java
44

55
[![CI](https://github.com/bufbuild/protovalidate-java/actions/workflows/ci.yaml/badge.svg)](https://github.com/bufbuild/protovalidate-java/actions/workflows/ci.yaml)
66
[![Conformance](https://github.com/bufbuild/protovalidate-java/actions/workflows/conformance.yaml/badge.svg)](https://github.com/bufbuild/protovalidate-java/actions/workflows/conformance.yaml)
77
[![BSR](https://img.shields.io/badge/BSR-Module-0C65EC)][buf-mod]
88

9-
[Protovalidate][protovalidate] provides standard annotations to validate common rules on messages and fields, as well as the ability to use [CEL][cel] to write custom rules. It's the next generation of [protoc-gen-validate][protoc-gen-validate], the only widely used validation library for Protobuf.
9+
[Protovalidate][protovalidate] is the semantic validation library for Protobuf. It provides standard annotations to validate common rules on messages and fields, as well as the ability to use [CEL][cel] to write custom rules. It's the next generation of [protoc-gen-validate][protoc-gen-validate].
1010

1111
With Protovalidate, you can annotate your Protobuf messages with both standard and custom validation rules:
1212

1313
```protobuf
1414
syntax = "proto3";
1515
16-
package banking.v1;
16+
package acme.user.v1;
1717
1818
import "buf/validate/validate.proto";
1919
20-
message MoneyTransfer {
21-
string to_account_id = 1 [
22-
// Standard rule: `to_account_id` must be a UUID
23-
(buf.validate.field).string.uuid = true
24-
];
20+
message User {
21+
string id = 1 [(buf.validate.field).string.uuid = true];
22+
uint32 age = 2 [(buf.validate.field).uint32.lte = 150]; // We can only hope.
23+
string email = 3 [(buf.validate.field).string.email = true];
24+
string first_name = 4 [(buf.validate.field).string.max_len = 64];
25+
string last_name = 5 [(buf.validate.field).string.max_len = 64];
2526
26-
string from_account_id = 2 [
27-
// Standard rule: `from_account_id` must be a UUID
28-
(buf.validate.field).string.uuid = true
29-
];
30-
31-
// Custom rule: `to_account_id` and `from_account_id` can't be the same.
3227
option (buf.validate.message).cel = {
33-
id: "to_account_id.not.from_account_id"
34-
message: "to_account_id and from_account_id should not be the same value"
35-
expression: "this.to_account_id != this.from_account_id"
28+
id: "first_name_requires_last_name"
29+
message: "last_name must be present if first_name is present"
30+
expression: "!has(this.first_name) || has(this.last_name)"
3631
};
3732
}
3833
```
@@ -69,7 +64,7 @@ Highlights for Java developers include:
6964
* A comprehensive RPC quickstart for [Java and gRPC][grpc-java]
7065
* A [migration guide for protoc-gen-validate][migration-guide] users
7166

72-
## Additional Languages and Repositories
67+
## Additional languages and repositories
7368

7469
Protovalidate isn't just for Java! You might be interested in sibling repositories for other languages:
7570

@@ -84,18 +79,13 @@ Additionally, [protovalidate's core repository](https://github.com/bufbuild/prot
8479
- [Conformance testing utilities][conformance] for acceptance testing of `protovalidate` implementations
8580

8681

87-
## Contribution
82+
## Contributing
8883

8984
We genuinely appreciate any help! If you'd like to contribute, check out these resources:
9085

9186
- [Contributing Guidelines][contributing]: Guidelines to make your contribution process straightforward and meaningful
9287
- [Conformance testing utilities](https://github.com/bufbuild/protovalidate/tree/main/docs/conformance.md): Utilities providing acceptance testing of `protovalidate` implementations
9388

94-
## Related Sites
95-
96-
- [Buf][buf]: Enterprise-grade Kafka and gRPC for the modern age
97-
- [Common Expression Language (CEL)][cel]: The open-source technology at the core of Protovalidate
98-
9989
## Legal
10090

10191
Offered under the [Apache 2 license][license].

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
assertj = "3.27.3"
33
buf = "1.55.1"
44
cel = "0.9.1"
5-
error-prone = "2.38.0"
6-
junit = "5.13.1"
5+
error-prone = "2.39.0"
6+
junit = "5.13.2"
77
maven-publish = "0.33.0"
88
protobuf = "4.31.1"
99

@@ -22,7 +22,7 @@ protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "p
2222
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "7.0.4" }
2323

2424
[plugins]
25-
errorprone = { id = "net.ltgt.errorprone", version = "4.2.0" }
26-
git = { id = "com.palantir.git-version", version = "3.3.0" }
25+
errorprone = { id = "net.ltgt.errorprone", version = "4.3.0" }
26+
git = { id = "com.palantir.git-version", version = "4.0.0" }
2727
maven = { id = "com.vanniktech.maven.publish.base", version.ref = "maven-publish" }
2828
osdetector = { id = "com.google.osdetector", version = "1.7.3" }

0 commit comments

Comments
 (0)