protoc-gen-validate icon indicating copy to clipboard operation
protoc-gen-validate copied to clipboard

email rule not working on google.protobuf.StringValue

Open xmlking opened this issue 6 years ago • 5 comments

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];
  }

xmlking avatar Jun 21 '19 16:06 xmlking

Thanks for the report! This is indeed a bug (the helper method is not being generated in the case of the WKT).

rodaine avatar Jun 21 '19 18:06 rodaine

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];

xmlking avatar Aug 07 '19 03:08 xmlking

@rodaine wonder if any possibility to get this fixed in next release?

xmlking avatar Aug 07 '19 04:08 xmlking

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

xmlking avatar Aug 09 '19 15:08 xmlking

any update on this ? Thanks

xmlking avatar Feb 09 '20 21:02 xmlking

Sorry, but why was this completed?

Anastasiya96 avatar Dec 13 '23 16:12 Anastasiya96

Please re-open if this is still an issue! (Sorry, I wasn't here when this was originally closed.)

chrispine avatar Feb 26 '24 22:02 chrispine