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

Add protovalidate as alternative to protoc-gen-validate #124

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tstirrat15
Copy link
Contributor

@tstirrat15 tstirrat15 commented Nov 21, 2024

Description

I ran into this while looking into authzed-rb's implementation of validation. I hoped that it might solve that problem, but it turns out that there isn't a protovalidate implementation for ruby either (yet, I hope).

I think there's still value in bringing this in, though.

protoc-gen-validate is in maintenance mode: https://github.com/bufbuild/protoc-gen-validate?tab=readme-ov-file#-protoc-gen-validate-pgv

The library they want us to move to is protovalidate: https://github.com/bufbuild/protovalidate

This follows the steps in the migration guide to add annotations that are compatible with protovalidate and allow the downstream libs to use the protovalidate libs as desired.

Notes

The breaking change lint step is complaining, but I ran it locally and it's not code that we use directly or control:

➜  api git:(use-protovalidate-instead-of-protoc-gen-validate) buf breaking . --against https://github.com/authzed/api.git\#branch\=main
protoc-gen-openapiv2/options/openapiv2.proto:45:1:Previously present reserved range "[13]" on message "Swagger" is missing values: [13] were removed.
protoc-gen-openapiv2/options/openapiv2.proto:587:1:Previously present reserved range "[1]" on message "Tag" is missing values: [1] were removed.

It appears to be complaining about the proto provided by the grpc-gateway dep, and that version bump happened when I added the new dependency. I'm not particularly concerned about it breaking anything.

Changes

Notes

This does not remove support for protoc-gen-validate. We probably won't do that for a while yet. This should be a non-breaking change.

Testing

Review. See that our CI still passes.

@tstirrat15 tstirrat15 changed the title Use protovalidate instead of protoc gen validate Add protovalidate as alternative to protoc-gen-validate Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant