Skip to content

[Feature Request] Lint cel expression #28

@toshi0607

Description

@toshi0607

Feature description:

I would be happy if cel expression validation is supported.

Problem it solves or use case:

When I buf lint the following proto, the second mistake is caught by buf lint proto/xxx/greeting/v1/greeting.proto:35:79:field xxx.greeting.v1.SayHelloResponse.request_time: option (buf.validate.field).timestamp.lt_nowwww: field lt_nowwww of buf.validate.TimestampRules does not exist, but the first one (cel expression) is not. I'd like to know if the expression is valid or not.

message SayHelloResponse {
  string message_id = 1;

  string message = 2 [(buf.validate.field).cel = {
    id: "sayHelloResponse.message",
    message: "message must start with 'Hello, ' and shorter than 1024",
    expression: "(this.startsWith('Hello, ') && this.string.max_lennnn "
  }];

  google.protobuf.Timestamp request_time = 3  [(buf.validate.field).timestamp.lt_nowwwwwww = true];
}

Proposed implementation or solution:

Is it possible to validate expression like other tools like linting IAM condition that checks cel validity?
https://cloud.google.com/iam/docs/linting-policies

Contribution:

Examples or references:

Additional context:

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions