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

[C++] Map key value string length message misleading

Open xamix opened this issue 3 years ago • 1 comments

Hi,

I use the following rules on a map<string, string>:

(validate.rules).map.keys.string.min_len = 1,

And when the rule is not respected, the error message is ending by:

value length must be at least 1 characters

Shouldn't it be:

key length must be at least 1 characters

Besause it is not clear if the key or the value do not respect the rule

Regards

xamix avatar Apr 25 '23 08:04 xamix

[GO] I use the following rules on a map<string, string>

[(validate.rules).map = {ignore_empty: true, keys: {string: {ignore_empty: true, pattern:"^[a-zA-Z- ]+$"}}, values: {string : {ignore_empty: true, pattern:"^[^<>]+$"}}}];

In file validate.go:

image

Regards

lehuunhan404 avatar Jun 27 '23 03:06 lehuunhan404