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

Repeated enum validation not_in is not generated #329

Closed
sashayakovtseva opened this issue Apr 14, 2020 · 2 comments · Fixed by #330
Closed

Repeated enum validation not_in is not generated #329

sashayakovtseva opened this issue Apr 14, 2020 · 2 comments · Fixed by #330

Comments

@sashayakovtseva
Copy link

Affected versions: v0.0.14, v0.1.0

Input test.proto:

syntax = "proto3";

package test;

option go_package = "test";

import "validate.proto";

enum Status {
  STATUS_INVALID = 0;
  STATUS_A = 1;
  STATUS_B = 2;
  STATUS_C = 3;
}

message Request {
  repeated Status status = 1 [(validate.rules).repeated = {unique: true, items: {enum: {defined_only: true, not_in: [0]}}}];
}

Generate command:

protoc \
  -I . \
  -I $GOPATH/src/github.com/envoyproxy/protoc-gen-validate/validate \
  --go_out=":." \
  --validate_out="lang=go:." \
  test/test.proto

Expect: all validate rules are generated correclty.

Actual: rules are generated, but _Request_Status_NotInLookup is undefined.

akonradi added a commit to akonradi/protoc-gen-validate that referenced this issue Apr 14, 2020
Generate code for C++ and Go for repeated.items.enum.{in, not_in}
validations, and add test cases. Fixes bufbuild#329

Signed-off-by: Alex Konradi <akonradi@google.com>
@akonradi
Copy link
Contributor

Thanks for the super-clear reproducer!

@penguingao
Copy link

I find that repeated.items.uint32.{in} is also seeing similar error.

rodaine pushed a commit that referenced this issue May 15, 2020
Generate code for C++ and Go for repeated.items.enum.{in, not_in}
validations, and add test cases. Fixes #329

Signed-off-by: Alex Konradi <akonradi@google.com>
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 a pull request may close this issue.

3 participants