protoc-gen-validate
protoc-gen-validate copied to clipboard
email rule not working on google.protobuf.StringValue
cannot add email rule on google.protobuf.StringValue but works on string type
getting following error:
m._validateEmail undefined (type *UserRequest has no field or method _validateEmail)
message UserRequest {
google.protobuf.UInt32Value id = 1 [(validate.rules).uint32.gte = 1];
google.protobuf.StringValue username = 2 [(validate.rules).string = {
min_len: 4
max_len: 16
pattern: "^[a-z0-9_-]{3,15}$",
max_bytes: 256,
}];
google.protobuf.StringValue firstName = 3 [(validate.rules).string.min_len = 3];
google.protobuf.StringValue lastName = 4 [(validate.rules).string.min_len = 3];
// string email = 5 [(validate.rules).string.email = true];
google.protobuf.StringValue email = 5 [(validate.rules).string.email = true];
}
Thanks for the report! This is indeed a bug (the helper method is not being generated in the case of the WKT).
similar issue for uuid validation
m._validateUuid undefined (type *UserRequest has no field or method _validateUuid)
google.protobuf.StringValue id = 1 [(validate.rules).string.uuid = true];
@rodaine wonder if any possibility to get this fixed in next release?
i am using override workaround , hope i can remove this if this is fixed.
https://github.com/xmlking/micro-starter-kit/blob/master/srv/account/proto/account/account.override.go#L45
any update on this ? Thanks
Sorry, but why was this completed?
Please re-open if this is still an issue! (Sorry, I wasn't here when this was originally closed.)