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

Allow specifying validators in grpc_api_configuration sidecar file #83

Open
v3n opened this issue Dec 13, 2019 · 0 comments
Open

Allow specifying validators in grpc_api_configuration sidecar file #83

v3n opened this issue Dec 13, 2019 · 0 comments

Comments

@v3n
Copy link

v3n commented Dec 13, 2019

grpc_api_configuration is a sidecar .yml file allowing for specifying varying API configurations outside of the .proto file. It would be awesome if go-proto-validators could generate validators for a gRPC configuration based on this, so that clients don't have to include go-proto-validators in a non-Go project.

To take the example on the README.

package validator.examples;
import "github.com/mwitkow/go-proto-validators/validator.proto";

message InnerMessage {
  // some_integer can only be in range (1, 100).
  int32 some_integer = 1 [(validator.field) = {int_gt: 0, int_lt: 100}];
  // some_float can only be in range (0;1).
  double some_float = 2 [(validator.field) = {float_gte: 0, float_lte: 1}];
}

Could be specified as:

validators:
  - selector: validator.examples.InnerMessage
    fields:
      - selector: some_integer
        field:
          int_gt: 0
          int_lt: 100
      - selector: some_float
        field:
          int_gt: 0
          int_lte: 1
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

No branches or pull requests

1 participant