bufbuild/vscode-buf

A repeated field is not recognized as a list type in CEL evaluation expressions

Opened this issue · 0 comments

I wrote a CEL evaluation expression using protovalidate for a repeated Message field, but a warning is issued because the value of this is not recognized as a list.

syntax = "proto3";

package example.hello.v1;

import "buf/validate/validate.proto";

message Hello {
  repeated int32 num_list = 1 [ (buf.validate.field).cel = {
    id : "repeated.int32.multiple5"
    message : "value must be multiple of 5"
    expression : "this.all(x, x % 5 == 0)"
  } ];
}

warnig text

(buf.validate.field).cel.expression on field "num_list" fails to compile: expression of type 'int' cannot be range of a comprehension (must be list, map, or dynamic)
 | this.all(x, x % 5 == 0)
 | ^ (PROTOVALIDATE)