{"id":21272688,"url":"https://github.com/bufbuild/protovalidate-go","last_synced_at":"2025-07-08T12:11:15.267Z","repository":{"id":171410863,"uuid":"647380678","full_name":"bufbuild/protovalidate-go","owner":"bufbuild","description":"Protocol Buffer Validation for Go","archived":false,"fork":false,"pushed_at":"2025-06-30T19:58:41.000Z","size":8192,"stargazers_count":393,"open_issues_count":4,"forks_count":27,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-06-30T20:42:26.150Z","etag":null,"topics":["cel","common-expression-language","go","golang","protobuf","protocol-buffers"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/buf.build/go/protovalidate","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bufbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-30T16:51:25.000Z","updated_at":"2025-06-30T19:58:43.000Z","dependencies_parsed_at":"2023-10-24T17:33:00.100Z","dependency_job_id":"afc213e4-5cf9-4f1f-b728-e54f58959a2b","html_url":"https://github.com/bufbuild/protovalidate-go","commit_stats":null,"previous_names":["bufbuild/protovalidate-go"],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/bufbuild/protovalidate-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bufbuild","download_url":"https://codeload.github.com/bufbuild/protovalidate-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-go/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264267170,"owners_count":23581933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cel","common-expression-language","go","golang","protobuf","protocol-buffers"],"created_at":"2024-11-21T09:01:51.122Z","updated_at":"2025-07-08T12:11:15.261Z","avatar_url":"https://github.com/bufbuild.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![The Buf logo](.github/buf-logo.svg)][buf]\n\n# protovalidate-go\n\n[![CI](https://github.com/bufbuild/protovalidate-go/actions/workflows/ci.yaml/badge.svg)](https://github.com/bufbuild/protovalidate-go/actions/workflows/ci.yaml)\n[![Conformance](https://github.com/bufbuild/protovalidate-go/actions/workflows/conformance.yaml/badge.svg)](https://github.com/bufbuild/protovalidate-go/actions/workflows/conformance.yaml)\n[![Report Card](https://goreportcard.com/badge/buf.build/go/protovalidate)](https://goreportcard.com/report/buf.build/go/protovalidate)\n[![GoDoc](https://pkg.go.dev/badge/buf.build/go/protovalidate.svg)](https://pkg.go.dev/buf.build/go/protovalidate)\n[![BSR](https://img.shields.io/badge/BSR-Module-0C65EC)][buf-mod]\n\n[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].\n\nWith Protovalidate, you can annotate your Protobuf messages with both standard and custom validation rules:\n\n```protobuf\nsyntax = \"proto3\";\n\npackage acme.user.v1;\n\nimport \"buf/validate/validate.proto\";\n\nmessage User {\n  string id = 1 [(buf.validate.field).string.uuid = true];\n  uint32 age = 2 [(buf.validate.field).uint32.lte = 150]; // We can only hope.\n  string email = 3 [(buf.validate.field).string.email = true];\n  string first_name = 4 [(buf.validate.field).string.max_len = 64];\n  string last_name = 5 [(buf.validate.field).string.max_len = 64];\n\n  option (buf.validate.message).cel = {\n    id: \"first_name_requires_last_name\"\n    message: \"last_name must be present if first_name is present\"\n    expression: \"!has(this.first_name) || has(this.last_name)\"\n  };\n}\n```\n\nOnce you've added `protovalidate-go` to your project, validation is idiomatic Go:\n\n```go\nif err = protovalidate.Validate(moneyTransfer); err != nil {\n    // Handle failure.\n}\n```\n\n## Installation\n\n\u003e [!TIP]\n\u003e The easiest way to get started with Protovalidate for RPC APIs are the quickstarts in Buf's documentation. They're available for both [Connect][connect-go] and [gRPC][grpc-go].\n\nTo install the package, use `go get` from within your Go module:\n\n```shell\ngo get buf.build/go/protovalidate\n```\n\n## Documentation\n\nComprehensive documentation for Protovalidate is available in [Buf's documentation library][protovalidate]. \n\nHighlights for Go developers include:\n\n* The [developer quickstart][quickstart]\n* Comprehensive RPC quickstarts for [Connect][connect-go] and [gRPC][grpc-go]\n* A [migration guide for protoc-gen-validate][migration-guide] users\n\nAPI documentation for Go is available on [pkg.go.dev][pkg-go].\n\n## Additional languages and repositories\n\nProtovalidate isn't just for Go! You might be interested in sibling repositories for other languages: \n\n- [`protovalidate-java`][pv-java] (Java)\n- [`protovalidate-python`][pv-python] (Python)\n- [`protovalidate-cc`][pv-cc] (C++)\n- [`protovalidate-es`][pv-es] (TypeScript and JavaScript)\n\nAdditionally, [protovalidate's core repository](https://github.com/bufbuild/protovalidate) provides:\n\n- [Protovalidate's Protobuf API][validate-proto]\n- [Conformance testing utilities][conformance] for acceptance testing of `protovalidate` implementations\n\n## Contributing\n\nWe genuinely appreciate any help! If you'd like to contribute, check out these resources:\n\n- [Contributing Guidelines][contributing]: Guidelines to make your contribution process straightforward and meaningful\n- [Conformance testing utilities](https://github.com/bufbuild/protovalidate/tree/main/docs/conformance.md): Utilities providing acceptance testing of `protovalidate` implementations\n- [Go conformance executor][conformance-executable]: Conformance testing executor for `protovalidate-go`\n\n## Legal\n\nOffered under the [Apache 2 license][license].\n\n[buf]: https://buf.build\n[cel]: https://cel.dev\n\n[pv-go]: https://github.com/bufbuild/protovalidate-go\n[pv-java]: https://github.com/bufbuild/protovalidate-java\n[pv-python]: https://github.com/bufbuild/protovalidate-python\n[pv-cc]: https://github.com/bufbuild/protovalidate-cc\n[pv-es]: https://github.com/bufbuild/protovalidate-es\n\n[buf-mod]: https://buf.build/bufbuild/protovalidate\n[license]: LICENSE\n[contributing]: .github/CONTRIBUTING.md\n\n[protoc-gen-validate]: https://github.com/bufbuild/protoc-gen-validate\n\n[protovalidate]: https://buf.build/docs/protovalidate/\n[quickstart]: https://buf.build/docs/protovalidate/quickstart/\n[connect-go]: https://buf.build/docs/protovalidate/quickstart/connect-go/\n[grpc-go]: https://buf.build/docs/protovalidate/quickstart/grpc-go/\n[grpc-java]: https://buf.build/docs/protovalidate/quickstart/grpc-java/\n[grpc-python]: https://buf.build/docs/protovalidate/quickstart/grpc-python/\n[migration-guide]: https://buf.build/docs/migration-guides/migrate-from-protoc-gen-validate/\n[conformance-executable]: ./internal/cmd/protovalidate-conformance-go/README.md\n[pkg-go]: https://pkg.go.dev/buf.build/go/protovalidate\n\n[validate-proto]: https://buf.build/bufbuild/protovalidate/docs/main:buf.validate\n[conformance]: https://github.com/bufbuild/protovalidate/blob/main/docs/conformance.md\n[examples]: https://github.com/bufbuild/protovalidate/tree/main/examples\n[migrate]: https://buf.build/docs/migration-guides/migrate-from-protoc-gen-validate/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufbuild%2Fprotovalidate-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbufbuild%2Fprotovalidate-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufbuild%2Fprotovalidate-go/lists"}