Skip to content

Commit

Permalink
Clarify that protovalidate does not require any code generation (#278)
Browse files Browse the repository at this point in the history
`protoc-gen-validate` is a plugin that generates validation code.
`protovalidate` uses runtime libraries instead, and does not require
code generation.

This seems to be a frequent point of confusion for users when migrating.
E.g. #275,
#269,
#177,
#178,
#73,
#47.

I suggest we spell out this major difference in the main readme and the
migration guide.

---------

Co-authored-by: Philip K. Warren <[email protected]>
  • Loading branch information
timostamm and pkwarren authored Nov 26, 2024
1 parent bebe6de commit 283c515
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ rules. The primary goal of `protovalidate` is to help developers ensure data
consistency and integrity across the network without requiring generated code.

> [!NOTE]
> `protovalidate` is the spiritual successor to [protoc-gen-validate][pgv].
> `protovalidate` is the spiritual successor to [protoc-gen-validate][pgv]. It does not require any code
> generation and supports custom constraints.
>
> We recommend that new and existing projects transition to using `protovalidate` instead of `protoc-gen-validate`.
>
Expand Down
7 changes: 6 additions & 1 deletion docs/migrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ incremental, and relatively painless, but it will still require a handful of
operations to get there. To ease this burden, we've provided this documentation
and a migration tool to simplify the process.

> [!NOTE]
>
> `protovalidate` does not require any code generation. The plugin `protoc-gen-validate`
> is no longer needed, and shouldn't be used with `protovalidate`.
## Migration process

1. **[OPTIONAL] Use `protovalidate` in legacy mode.** If supported, an
Expand Down Expand Up @@ -158,4 +163,4 @@ manual migration:
[go-legacy]: https://github.com/bufbuild/protovalidate-go/README.md#support-legacy-protoc-gen-validate-constraints
[format]: https://buf.build/docs/format/style/
[validate]: https://buf.build/bufbuild/protovalidate/docs/main:buf.validate#buf.validate.FieldConstraints
[ignore]: https://buf.build/bufbuild/protovalidate/docs/main:buf.validate#buf.validate.Ignore
[ignore]: https://buf.build/bufbuild/protovalidate/docs/main:buf.validate#buf.validate.Ignore

0 comments on commit 283c515

Please sign in to comment.