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

Protoc is not generating any validators. #47

Closed
FrontMage opened this issue Jul 18, 2018 · 1 comment
Closed

Protoc is not generating any validators. #47

FrontMage opened this issue Jul 18, 2018 · 1 comment

Comments

@FrontMage
Copy link

protoc \
--go_out=plugins=grpc:./lib/protos/ \
--proto_path=/Users/frontmage/go/src \
--proto_path=/Users/frontmage/go/src/github.com/google/protobuf/src \
--proto_path=./protos/common/ \
--proto_path=./protos/server/ \
--govalidators_out=./lib/protos \
./protos/common/*.proto \
./protos/server/*.proto 

I'm using protoc to generate validators for my proto file, but the validator function is just return nil.

message LoginReq {
    string login_id = 1 [(validator.field) = {msg_exists : true}];
}
func (this *LoginReq) Validate() error {
         return nil
}

The protoc command shows no errors, so how to properly generate validators?

@FrontMage
Copy link
Author

It seems that only pointer type will be checked with msg_exists, closing it.

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