Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some general questions #224

Closed
dpservis opened this issue Jul 8, 2024 · 1 comment
Closed

Some general questions #224

dpservis opened this issue Jul 8, 2024 · 1 comment
Labels
Question Questions about the project or libraries

Comments

@dpservis
Copy link

dpservis commented Jul 8, 2024

Hi,

I am trying to figure out the following:

  1. Do I need protovalidate and protovalidate-cc when working with C++?
  2. How do I build on Windows?
  3. Does protovalidate generate validation code which needs extra runtime? If yes, why not generate validation code within the serialization classes?
@rodaine
Copy link
Member

rodaine commented Jul 12, 2024

Hi, @dpservis!

Do I need protovalidate and protovalidate-cc when working with C++?

Your protos will have a dependency on those in protovalidate, and you will use the protovalidate-cc library to perform the validation on your messages.

How do I build on Windows?

Nothing in the protovalidate ecosystem is OS-specific. The same tooling you use to work with a C++ codebase on Windows is still applicable. I'd refer to the usage documentation in the protovalidate-cc repo for examples. If you encounter anything not working, or if there's anything that we can clarify in our documentation, please feel free to open an issue on the appropriate repository.

Does protovalidate generate validation code which needs extra runtime? If yes, why not generate validation code within the serialization classes?

Protovalidate does not perform any code generation; all validators are built at runtime and cached for that message type. Our blog post on the kickoff of protovalidate as a replacement for protoc-gen-validate, goes into details why code generation is not worth it in this space.

If the concern is performance, we have benchmark numbers for the Go implementation showing sub-100ns execution of validation rules against messages with an (amortized) zero allocations after the first time a message type is encountered.

@rodaine rodaine added the Question Questions about the project or libraries label Jul 12, 2024
@rodaine rodaine closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Questions about the project or libraries
Projects
None yet
Development

No branches or pull requests

2 participants