Skip to main content

proto/validate_phase2.proto

syntax = "proto3";

package validate_phase2;

import "buf/validate/validate.proto";
import "google/protobuf/timestamp.proto";

message MessageCEL {
  option (buf.validate.message).cel = {
    id: "x"
    message: "value must not be empty"
    expression: "this.value.size() > 0"
  };

  string value = 1;
}

message FieldCEL {
  string value = 1 [(buf.validate.field).cel = {
    id: "y"
    message: "field value must not be empty"
    expression: "this.size() > 0"
  }];
}

message MessageCELExpression {
  option (buf.validate.message).cel_expression = "this.value.size() > 0";

  string value = 1;
}

message FieldCELExpression {
  string value = 1 [(buf.validate.field).cel_expression = "this.size() > 0"];
}

message NowCEL {
  option (buf.validate.message).cel = {
    id: "now_eq"
    expression: "now == now"
  };

  google.protobuf.Timestamp value = 1 [(buf.validate.field).cel = {
    id: "future"
    message: "value must be in the future"
    expression: "this > now"
  }];
}