protoc-gen-validate icon indicating copy to clipboard operation
protoc-gen-validate copied to clipboard

RFC: Your PGV Wishlist

Open elliotmjackson opened this issue 3 years ago • 3 comments

The team at @bufbuild are excited to begin maintaining PGV.

This project fills a huge gap in the protobuf ecosystem and deserves careful stewardship. As a company, our incentives are well-aligned with the PGV community's. We want protobuf to be feature-complete and easy to use for personal projects, tiny startups, and giant megacorporations alike, because wider protobuf adoption increases the market for our paid schema registry product. We will take care not to break existing PGV users, and we can devote enough time to the project to clear out the issue backlog and possibly support additional languages. We will, of course, keep everything under an Apache 2 license.

We appreciate the PGV community's continued paitence whilst we iron out a detailed transition plan and thank the @envoyproxy team for all that hard work they've put in to date.

Right now, we want to hear from you - What do you want to see from PGV? What major bugs have you run into and would like to see fixed? Or better yet, what have you already fixed that you'd like merged?

elliotmjackson avatar Sep 21 '22 14:09 elliotmjackson

would love to see ruby support!

sarahegler avatar Sep 21 '22 17:09 sarahegler

Some more color on the Ruby ask by Sarah. We use protobuf schemas heavily at Chime in general, and have lots of Ruby on Rails services that we actively want to move to Protobuf + Twirp. Autogeneration of parameter validation code will really DRY-up our APIs and help with better documentation too by making the semantic rules explicit. We'd greatly appreciate you prioritizing building support for Ruby in this tool. Thank you for taking ownership of PGV and really excited about its evolution!

shine-garg-chime avatar Sep 21 '22 18:09 shine-garg-chime

I would love to see issue https://github.com/envoyproxy/protoc-gen-validate/issues/74 resolved.

mmrath avatar Sep 22 '22 05:09 mmrath

IMO the most upvoted issues is a good start.

kindermoumoute avatar Oct 04 '22 12:10 kindermoumoute

Not having all valid issues closed without any resolution, since those were wishes. 😝

Fleshgrinder avatar Oct 04 '22 17:10 Fleshgrinder

Should or could we re-open specific issues that had good context and we're good wish list items, for example: https://github.com/bufbuild/protoc-gen-validate/issues/405

pquerna avatar Oct 04 '22 22:10 pquerna

Hi everyone! This is my fault, after recently taking over maintenance of PGV with 100 issues and 30 open PRs, trying to get a grasp of the current state of the project has been tricky and after a month of fixing various bugs, some tickets I thought were stale or resolved may have been caught up in the mix.

I'll go back over the issues I closed and reopen any that stand out. If I miss any, please don't hesitate to reopen any of particular interest yourself.

But this is a good thing, whilst jagged, all of this helps me and the team develop a deeper understanding of where the project should go and where we should focus our attention immediately.

elliotmjackson avatar Oct 05 '22 15:10 elliotmjackson

Node, Deno Support #71

If connect-node and PGV can be combined, great!

utamori avatar Oct 10 '22 00:10 utamori

Swift support 🙏🏻

Maragues avatar Oct 10 '22 09:10 Maragues

I would love to see official plugin for buf and more string rules such as alphanumeric etc. Thank you for your hard work! Love the project 💙

ysomad avatar Oct 12 '22 21:10 ysomad

Better structure for validation errors. When validation fails on a deeply-nested message instead of a massive string it'd be great to see JSONSchema-style errors with structure that can be handled by client code.

ccakes avatar Oct 19 '22 23:10 ccakes

Combined validations. E.g. if name = John, then age must > 50. Silly example, but it explains the idea.

message Person {
  string name = 1;
  int32 age = 2;
}

Real world example , we have an enum that determines whether this repeated should have size 1 or not.

trietsch avatar Nov 07 '22 13:11 trietsch

Custom error message!!!

m430 avatar Nov 08 '22 05:11 m430

Custom error message!!!

shuqingzai avatar Nov 08 '22 05:11 shuqingzai

  • make it possible to have a validation rule on both map keys and values. currently, only one of them is honored.
  • typescript support, ideally so it can be used in combination with connect-web and/or ts-proto.

birdayz avatar Nov 15 '22 08:11 birdayz

I would like to be able to generate a JSON schema that includes validation rules specified using validate.rules.

Some options I can thing of:

  • Generate some language neutral output that can be used from protoc-gen-jsonschema
  • Change protoc-gen-jsonschema to understand the rules specified with validate.rules.
  • Change protoc-gen-validate to generate JSON schema.

None of these options are great though. Would like to know what others think.

Closed issue relating to this request:

  • https://github.com/bufbuild/protoc-gen-validate/issues/615

aucampia avatar Dec 13 '22 13:12 aucampia

I would like to be able to validate a stream of protobuf messages using protoc-gen-validate annotations without writing some custom code.

aucampia avatar Dec 13 '22 13:12 aucampia

Export of validation rules to JSON-schema is the most needed feature in my opinion. I would like to use this so that front-end developers get the validation rules from the proto, and not duplicate them themselves.

dimuska139 avatar Feb 01 '23 13:02 dimuska139

@elliotmjackson any timeline for the new release? The last release was on December 2022.

elb3k avatar Mar 15 '23 05:03 elb3k

@aucampia I'd be open to supporting this in protoc-gen-jsonschema for sure

chrusty avatar Apr 09 '23 20:04 chrusty

Hello everyone!

I am excited to announce the release of protoc-gen-validate (PGV) v1.0! After half a decade of being labeled “alpha,” we’ve decided it’s time to promote PGV to v1.0, ensuring stability for all current workflows. 🎉

But that’s not all! We’re also announcing the imminent release of the future of validation: v2.0 of PGV, soon to be known as protovalidate. This new version, with its first release candidate coming in early June, will be based on Common Expression Language (CEL) and provide a much better foundation for validation going forward. :rocket:

In our latest blog post, we reflect on PGV’s history, discuss its limitations, and give you a sneak peek into the exciting features we’re working on for protovalidate. Check it out here: Announcing protoc-gen-validate v1.0 and our plans for v2.0

As always, your feedback is invaluable to us. So please, take a moment to read the blog post and let us know your thoughts. Feel free to share your ideas or feature requests in this wishlist GitHub issue.

Thank you for your ongoing support, and we look forward to hearing from you as we continue to shape the future of Protobuf validation together!

elliotmjackson avatar Apr 24 '23 17:04 elliotmjackson

In terms of feature requests/wishlist, have you given any thought to message-level rather than field-level validation? For example, google.type.Date says:

// This can represent one of the following:
//
// * A full date, with non-zero year, month, and day values
// * A month and day value, with a zero year, such as an anniversary
// * A year on its own, with zero month and day values
// * A year and month value, with a zero day, such as a credit card expiration
// date

It would be nice to be able to write a message option to express/enforce this, e.g. (year > 0 && month > 0 && day > 0) || (month > 0 && day > 0 && year == 0) || (year > 0 && month == 0 && day == 0) || (year > 0 && month > 0 && day ==0).

rofrankel avatar Apr 26 '23 19:04 rofrankel

Validation rules on methods! Without this, it makes it really hard to define validation rules on messages that are intended to be shared between more than one endpoint, even if said messages only form part of a request.

Validation transferral Really just throwing this idea out there. I would like the ability to say "Copy the validation rules from {name}", where name is the symbol of a proto message, eg: foo.bar.v1.Message.field.

anzboi avatar Apr 27 '23 05:04 anzboi

A way to provide sample values would be great. These are useful for e.g. generating sample code snippets for APIs.

Arguably this is beyond the scope of validation, but on the other hand it does feel somewhat related, in the sense that the sample values should certainly pass the validation rules (and an API linter might want to validate such a thing).

rofrankel avatar Apr 28 '23 21:04 rofrankel

Our team would love to have support for the C#/.Net ecosystem

gRPC and proto files are cross-platform and supported in many languages but, so far, PGV does not support C# despite being one of the most popular languages. Having PGV support C# would greatly help in making gRPC a modern alternative to SOAP when it comes to interoperability across technical stacks for services that needs to be defined with rich data validation rules like it is possible in XSD for SOAP.

FrancoisHub avatar May 07 '23 19:05 FrancoisHub

This is great news! Some ideas I've been chewing on:

  • Some sort of ternary logic similar to SQL check constraints where evaluating a null (missing field) is ignored.

  • Define validation on methods, messages, and fields. Defining validation on methods and messages supports cross-field validation.

  • An optimizing expression compiler. A validation like val > 10 should compile into an if statement. Alternately, use reflection to keep generated code size down.

  • Support custom CEL methods.

jschaf avatar May 12 '23 06:05 jschaf

  • Support #74

FarmerChillax avatar May 17 '23 01:05 FarmerChillax

python support pydantic

so1n avatar May 17 '23 02:05 so1n

We'd benefit from C#/.NET support at Roblox as well.

rofrankel avatar May 17 '23 19:05 rofrankel

That looks promising !

I had a similar approach in my protoc-gen-cel-validate validation plugin built around CEL. Here are some features that I was able to implement and that might be useful here:

  • Add the possibility to validate nested messages from CEL directly
  • Support partial validation functions, with something like fieldmasks
  • Support function overloads (registering functions in the CEL runtime from code)
  • Having a way to reuse CEL constants / variables / functions to avoid duplication

nlachfr avatar May 18 '23 06:05 nlachfr