Proto3 reusing field options

128 Views Asked by At

We are writing a lot of validation rules using protovalidate. Some of rules are custom rules writen with protovalidate's cel expressions.

Are there any way to reuse field options with import ?

For example,

Normally we are using like below;

message AMessageName {
    string xxx = 1 [(buf.validate.field) = {
        cel: {
            id: "uniqueruleid",
            message: "validation fail message",
            expression: "an expression to check validity"
        }
    }];
}

But we want to do like below;

message AMessageName {
    string xxx = 1 [(buf.validate.field) = IMPORTED_RULE_VARIABLE];
}

Thanks.

0

There are 0 best solutions below