You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
message MyMessage {
ParentObj obj = 1;
google.protobuf.FieldMask field_mask = 2;
option (buf.validate.message).cel = {
id: "obj.code",
message: "code should be present"
expression: "this.field_mask.paths.exists(p, p == 'obj.code')"
};
}
reason I was trying to perform this check at message level is to validate a nested field of ParentObj only when it is present in field mask. i.e, perform validation when it is specified in field mask. I was trying to use nested ternary operation to acheive it but in vain.
After some tests, realized that validation for field mask paths is not working at message level.
Even with or without obj.code in field mask, I see the error message for this validation error that code should be present.
If what you're looking for instead is to have protovalidate use a FieldMask to decide which fields to perform validation on generally, that feature does not exist. If you'd like, feel free to open a feature request issue over on the protovalidate repo for further discussion. There's a somewhat adjacent issue that covers skipping validation on certain fields.
Here is my message
reason I was trying to perform this check at message level is to validate a nested field of
ParentObj
only when it is present in field mask. i.e, perform validation when it is specified in field mask. I was trying to use nested ternary operation to acheive it but in vain.After some tests, realized that validation for field mask paths is not working at message level.
Even with or without
obj.code
in field mask, I see the error message for this validation error thatcode should be present
.Environment
Possible Solution
Additional Context
The text was updated successfully, but these errors were encountered: