protovalidate icon indicating copy to clipboard operation
protovalidate copied to clipboard

[Feature Request] Required validate options with buf lint

Open acrazing opened this issue 1 year ago • 0 comments

Feature description:

When run buf lint, can check if all fields has some protovalidate options. Especially for:

  • string/bytes max length
  • repeated/map max items

Problem it solves or use case:

This ensures that developers don't forget to write these options.

And also make sure these fields is not too long or has too many elements, which is important to ensure that system resources are not exhausted. For example:

For this API request message:

message BatchGetUserRequest {
  repeated int64 user_ids = 1;
}

The maximum elements number of user_ids is required for system, or it may cause database resource exhaustion.

Proposed implementation or solution:

  1. Add a cli protovalidate lint command to run standalone with custom config file protovalidate.yaml.
  2. Integrate with buf lint as a plugin.

Contribution:

If this proposal is accepted, I can do that.

Examples or references:

NO

Additional context:

NO

acrazing avatar Oct 03 '24 04:10 acrazing