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

Use bufbuild/protoc-gen-validate to add Protobuf Message validation annotations and auto-generate Validate methods #11882

Closed
2 of 4 tasks
odeke-em opened this issue May 5, 2022 · 5 comments
Labels
Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.

Comments

@odeke-em
Copy link
Collaborator

odeke-em commented May 5, 2022

Internally at Orijtech Inc, our very own @kirbyquerby noted that we should be using https://github.com/envoyproxy/protoc-gen-validate to annotate protobuf Message fields for validation, and then have .Validate methods instead of manually writing validators for every struct in code.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@odeke-em odeke-em added the Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. label May 5, 2022
@aaronc
Copy link
Member

aaronc commented May 5, 2022

I've looked at this before and I like the idea. I just don't think this particular tools helps us much - it mostly has validations we don't need and doesn't have the ones we do. I propose we do something similar but design it for our use cases.

@tac0turtle
Copy link
Member

Closing this, we have looked into it as Aaron mentioned. If we come back to it we can open a new issue

@aaronc
Copy link
Member

aaronc commented Jan 19, 2023

Now that this tool is maintained by buf and moved to https://github.com/bufbuild/protoc-gen-validate it seems to have evolved a bit and has many more validations which may be useful to use. Thinking we should reopen and consider, especially in light of #11275.

@aaronc aaronc reopened this Jan 19, 2023
@aaronc aaronc changed the title all/proto: use envoy/protoc-gen-validate to add Protobuf Message validation annotations then auto-generate .Validate methods all/proto: use bufbuild/protoc-gen-validate to add Protobuf Message validation annotations then auto-generate .Validate methods Jan 19, 2023
@aaronc aaronc changed the title all/proto: use bufbuild/protoc-gen-validate to add Protobuf Message validation annotations then auto-generate .Validate methods Use bufbuild/protoc-gen-validate to add Protobuf Message validation annotations and auto-generate Validate methods Jan 19, 2023
@mfridman
Copy link

mfridman commented May 3, 2023

Hey @aaronc, figured I'd drop here and mention we're working on a v2 version for Protobuf validation, it'll be a runtime library called protovalidate and at its core, it'll use Common Expression Language (CEL).

You can read more about it here: Announcing protoc-gen-validate v1.0 and our plans for v2.0

Having said that, we'll continue to maintain protoc-gen-validate v1 in its current form. We're happy to help or bounce ideas if you like.

@tac0turtle
Copy link
Member

tac0turtle commented May 3, 2023

we opted to have validation live in the message server, there isnt a need for this anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

No branches or pull requests

4 participants